Open Problem for SUAVe User Group Meeting, November 26, 2013 (UVic)

Size: px
Start display at page:

Download "Open Problem for SUAVe User Group Meeting, November 26, 2013 (UVic)"

Transcription

1 Open Problem for SUAVe User Group Meeting, November 26, 2013 (UVic) Background The data in a SAS dataset is organized into variables and observations, which equate to rows and columns. While the order of rows (or observations) is often relevant to data step processing, the order of the variables in a dataset doesn't matter. But sometimes the order of the variables matters to people. Sometimes we want to interactively view a SAS dataset. When there are a large number of variables in the dataset, it may be awkward to scroll back and forth between variables we're interested in. When you use a data step to create a dataset, SAS decides on the order of variables, basically adding each variable as soon as its required storage space is known. The Problem For this problem, let's assume you've received a dataset that has a large number of variables in an inconvenient order. You want to create a new version of the dataset where the variables have been rearranged into alphabetical order. When interactively viewing the new dataset, finding specific variables will be much easier while scrolling left and right. There are two levels at which you can attack this problem. You can come up with a solution that works for the problem dataset only, or a more general solution that will work for any SAS dataset. The former requires a bit of typing, but the latter may be a much more difficult task! Feel free to tackle either problem. The code below can be executed to create the sample dataset, named random, which has 40 randomly named variables. (Because the seed is fixed, everyone should be working with the same data.) Please run that code first, and then write your solution to make a new copy of the dataset with the variables sorted in alphabetical order. Please be prepared to present your solution at the November SUAVe meeting. Good luck! Code to create the random dataset is on the next page. 1

2 * Create the open problem dataset, named RANDOM; %let seed = ; * seed for variable names; %let seed2 = 9731; * seed for values in dataset; data _null_; length var_name prev_var_name $ 4; call execute('data random;'); call execute('drop i;'); * create 50 observations; call execute('do i = 1 to 50;'); * create 40 variables; do j = 1 to 40; * names are each 4 characters long; do k = 1 to 4; substr(var_name, k, 1) = byte(64 + ceil(ranuni(&seed) * 26) + ((ranuni(&seed) > 0.5) * 32)); end; if (j = 1) then call execute(var_name " = round(i ** (ranuni(&seed2) * 2), 0.01);"); else call execute(var_name ' = round(' prev_var_name ' * 1.5, 0.01);'); prev_var_name = var_name; end; call execute('output;'); call execute('end;'); call execute(''); 2

3 The Solutions: 1. Antoine Lalumiѐre, Canadian Forest Service ****************************************************************************************; * Solution to the SUAVe 26NOV2013 Open Problem - Not using the results of PROC CONTENTS or PROC DATASETS to reorder variables. *; * Antoine Lalumière, NRCan, Canadian Wood Fibre Centre, Pacific Forestry Centre, Antoine.Lalumiere@nrcan.gc.ca. *; ****************************************************************************************; * Have a preliminary look at the variable formats. The transpose procedure works differently for numeric and character variables. ; * Note that the ORDER=VARNUM orders the results by variable number. ; options ps=32767 ls=64 nodate nonumber nocenter ; proc contents data=random ORDER=VARNUM; options ls=256; * Have a look at the original dataset. ; proc print data=random; title 'Original random dataset'; * Transpose the entire dataset - Rows become columns, and columns become rows. ; proc transpose data=random out=transposed; proc print data=transposed; title 'Transposed random dataset'; * Sort the transposed dataset by _NAME_ to order the variables (each of which is now on a row-record) by the original variable name. ; * Note that the SORTSEQ option is used to disregard case when sorting. ; proc sort SORTSEQ=LINGUISTIC(STRENGTH=PRIMARY) data=transposed out=trsorted; by _NAME_; proc print data=trsorted; title 'Transposed sorted dataset'; * Transpose the sorted dataset again, turning columns back into rows, and rows back into columns. ; proc transpose data=trsorted out=sorted(drop=_name_); proc print data=sorted; title 'Final sorted dataset'; * Have a last look at the variables to ensure the variable re-ordering went smoothly. ; * Note that the ORDER=CASECOLLATE option is used to order the results without regard to case. ; * If this option is not used, PROC CONTENTS orders upper case results before lower case.; options ls=64; proc contents data=sorted ORDER=CASECOLLATE; * Have fun with the TRANSPOSE procedure! ; 3

4 2. Joel Choy, BC Ministry of Health proc datasets; contents data=random order=ignorecase out=columns ; Run; data columns_out (keep=name); set columns; filename retainf 'H:\temp\retains.txt'; data _null_; length retain_literal $6. ; retain_literal = 'retain'; semicolon_literal = ';'; set columns_out; file retainf; retain_literal name semicolon_literal $1.; data random_out; %include 'H:\temp\retains.txt'; set random; 3. Peter Ott, BC Ministry of Forests, Lands & NRO proc contents data=random out=vars(keep=varnum name) noprint; proc sort data=vars; *this step is not really necessary since proc contents already sorted in alphabetical order; by name; data _null_; length var_names $ 999.; *this will hopefully be long enough; set vars end=last; retain var_names ''; var_names=catx(' ', var_names, name); *removes leading and trailing blanks, inserts a delimiter, and returns a concatenated character string; if last then output; call symput('ordered', var_names); *sticking into macro; %put &ordered; data new; array allvars{*} &ordered; *array statement overrides original order - could also use attrib, format, informat, retain or length statements; set random; quit; 4

5 4. Dale Starr, BC Ministry of Health * * * SUAVe (SAS Users Association of Victoria, eh?) meeting Nov 26, * * Open Problem, extract SAS column names and change column order - Three solutions * * * Solution 1 PROC CONTENTS Method to create a Macro variable containing the list of column names. * Use PROC CONTENTS to get column names. The varnum variable is unnecessary. ; * Note the default SAS sort order for the output dataset is that the column names ; * are sorted by UPPERCASE alphabetical then LOWERCASE alphabetical. ; PROC CONTENTS DATA = work.random OUT = var_list01 (KEEP = name varnum) NOPRINT; * This step is unnecessary. ; * Sort data back into the original column name order to compare against original ; * input file. ; PROC SORT DATA = var_list01 OUT = srt_var_lst01; BY varnum; * Use PROC SQL to write the column names into a Macro variable ; * i.e INTO :<varname>, note SEPARATED BY " " to be used in a DATA step ; PROC SQL NOPRINT; SELECT name INTO :macro_var_lst01 SEPARATED BY " " FROM srt_var_lst01 ORDER BY UPPER(name); * Check the contents of the Macro variable.; %PUT &macro_var_lst01; * Create final data set using a DATA step. Could also be done with PROC SQL ; * Use Macro variable in the RETAIN statement to put columns in alphabetical order.; DATA Out_file01; RETAIN &macro_var_lst01; SET work.random; END PROC CONTENTS Method to create a Macro variable containing the list of column names. Solution 2 5

6 DICTIONARY.COLUMNS Method to create a Macro variable containing the list of column * Create macro in one step using DICTIONARY.COLUMNS *; * Note SEPARATED BY ", " to be used in a PROC SQL *; PROC SQL NOPRINT; SELECT name INTO :macro_var_lst02 SEPARATED BY ", " FROM dictionary.columns WHERE memname = 'RANDOM' AND libname = 'WORK' ORDER BY UPPER(name); * Check the contents of the Macro variable.; %PUT &macro_var_lst02; * Create final data set using PROC SQL. Could also be done with a data step. ; PROC SQL; CREATE TABLE Out_file02 AS SELECT &macro_var_lst02 FROM work.random END DICTIONARY.COLUMNS Method to create a Macro variable containing the list of column Solution 3 SASHELP.VCOLUMN Method to create a Macro variable containing the list of column * Use SAS system data set sashelp.vcolumn in a DATA step to get column names. ; * Note the only required variable is NAME. ; DATA var_list03; SET sashelp.vcolumn; WHERE memname = 'RANDOM'; KEEP name varnum; * Use PROC SQL to write the column names into a Macro variable. ; * Note I am creating two macro variables, one separated by comma the other by a ; * space in order to create the final data sets with a DATA step and PROC SQL. ; PROC SQL NOPRINT; SELECT name, name AS name2 INTO :macro_var_lst03 SEPARATED BY ", ", :macro_var_lst03b SEPARATED BY " " FROM var_list03 ORDER BY UPPER(name), 6

7 UPPER(name2); * Check the contents of the Macro variables.; %PUT &macro_var_lst03; %PUT &macro_var_lst03b; * Create final data set. A DATA step or PROC SQL could be used. *; PROC SQL; CREATE TABLE Out_file03 AS SELECT &macro_var_lst03 FROM work.random DATA Out_file03b; RETAIN &macro_var_lst03b; SET work.random; * END SASHELP.VCOLUMN Method to create a Macro variable containing the list of column 5. Aijun Yang, BC Ministry of Health Use PROC SQL to create alphabetical list of variable names from dictionary tables Define libname if libname is not WORK Note the values of libname and memname need to in upper case %macro reorder(libnm, datain,dataout); proc sql noprint; select distinct name into : varlist separated by ' ' from dictionary.columns where libname="&libnm" and memname="&datain"; quit; data &dataout; retain &varlist; set &datain; %mend; %reorder(%upcase(work),%upcase(random), reorder_random); 7

The Power of PROC SQL Techniques and SAS Dictionary Tables in Handling Data

The Power of PROC SQL Techniques and SAS Dictionary Tables in Handling Data Paper PO31 The Power of PROC SQL Techniques and SAS Dictionary Tables in Handling Data MaryAnne DePesquo Hope, Health Services Advisory Group, Phoenix, Arizona Fen Fen Li, Health Services Advisory Group,

More information

Taming a Spreadsheet Importation Monster

Taming a Spreadsheet Importation Monster SESUG 2013 Paper BtB-10 Taming a Spreadsheet Importation Monster Nat Wooding, J. Sargeant Reynolds Community College ABSTRACT As many programmers have learned to their chagrin, it can be easy to read Excel

More information

Know Thy Data : Techniques for Data Exploration

Know Thy Data : Techniques for Data Exploration Know Thy Data : Techniques for Data Exploration Montreal SAS Users Group Wednesday, 29 May 2018 13:50-14:30 PM Andrew T. Kuligowski, Charu Shankar AGENDA Part 1- Easy Ways to know your data Part 2 - Powerful

More information

Uncommon Techniques for Common Variables

Uncommon Techniques for Common Variables Paper 11863-2016 Uncommon Techniques for Common Variables Christopher J. Bost, MDRC, New York, NY ABSTRACT If a variable occurs in more than one data set being merged, the last value (from the variable

More information

Arthur L. Carpenter California Occidental Consultants, Oceanside, California

Arthur L. Carpenter California Occidental Consultants, Oceanside, California Paper 028-30 Storing and Using a List of Values in a Macro Variable Arthur L. Carpenter California Occidental Consultants, Oceanside, California ABSTRACT When using the macro language it is not at all

More information

Developing Data-Driven SAS Programs Using Proc Contents

Developing Data-Driven SAS Programs Using Proc Contents Developing Data-Driven SAS Programs Using Proc Contents Robert W. Graebner, Quintiles, Inc., Kansas City, MO ABSTRACT It is often desirable to write SAS programs that adapt to different data set structures

More information

Tips & Tricks. With lots of help from other SUG and SUGI presenters. SAS HUG Meeting, November 18, 2010

Tips & Tricks. With lots of help from other SUG and SUGI presenters. SAS HUG Meeting, November 18, 2010 Tips & Tricks With lots of help from other SUG and SUGI presenters 1 SAS HUG Meeting, November 18, 2010 2 3 Sorting Threads Multi-threading available if your computer has more than one processor (CPU)

More information

Posters. Workarounds for SASWare Ballot Items Jack Hamilton, First Health, West Sacramento, California USA. Paper

Posters. Workarounds for SASWare Ballot Items Jack Hamilton, First Health, West Sacramento, California USA. Paper Paper 223-25 Workarounds for SASWare Ballot Items Jack Hamilton, First Health, West Sacramento, California USA ABSTRACT As part of its effort to insure that SAS Software is useful to its users, SAS Institute

More information

Contents of SAS Programming Techniques

Contents of SAS Programming Techniques Contents of SAS Programming Techniques Chapter 1 About SAS 1.1 Introduction 1.1.1 SAS modules 1.1.2 SAS module classification 1.1.3 SAS features 1.1.4 Three levels of SAS techniques 1.1.5 Chapter goal

More information

Mimicking the Data Step Dash and Double Dash in PROC SQL Arlene Amodeo, Law School Admission Council, Newtown, PA

Mimicking the Data Step Dash and Double Dash in PROC SQL Arlene Amodeo, Law School Admission Council, Newtown, PA ABSTRACT Mimicking the Data Step Dash and Double Dash in PROC SQL Arlene Amodeo, Law School Admission Council, Newtown, PA The SQL procedure is a powerful and versatile procedure in SAS that allows the

More information

SQL Metadata Applications: I Hate Typing

SQL Metadata Applications: I Hate Typing SQL Metadata Applications: I Hate Typing Hannah Fresques, MDRC, New York, NY ABSTRACT This paper covers basics of metadata in SQL and provides useful applications, including: finding variables on one or

More information

How to Keep Multiple Formats in One Variable after Transpose Mindy Wang

How to Keep Multiple Formats in One Variable after Transpose Mindy Wang How to Keep Multiple Formats in One Variable after Transpose Mindy Wang Abstract In clinical trials and many other research fields, proc transpose are used very often. When many variables with their individual

More information

Writing Programs in SAS Data I/O in SAS

Writing Programs in SAS Data I/O in SAS Writing Programs in SAS Data I/O in SAS Statistics 135 Autumn 2005 Copyright c 2005 by Mark E. Irwin Writing SAS Programs Your SAS programs can be written in any text editor, though you will often want

More information

%MISSING: A SAS Macro to Report Missing Value Percentages for a Multi-Year Multi-File Information System

%MISSING: A SAS Macro to Report Missing Value Percentages for a Multi-Year Multi-File Information System %MISSING: A SAS Macro to Report Missing Value Percentages for a Multi-Year Multi-File Information System Rushi Patel, Creative Information Technology, Inc., Arlington, VA ABSTRACT It is common to find

More information

Validation Summary using SYSINFO

Validation Summary using SYSINFO Validation Summary using SYSINFO Srinivas Vanam Mahipal Vanam Shravani Vanam Percept Pharma Services, Bridgewater, NJ ABSTRACT This paper presents a macro that produces a Validation Summary using SYSINFO

More information

Give me EVERYTHING! A macro to combine the CONTENTS procedure output and formats. Lynn Mullins, PPD, Cincinnati, Ohio

Give me EVERYTHING! A macro to combine the CONTENTS procedure output and formats. Lynn Mullins, PPD, Cincinnati, Ohio PharmaSUG 2014 - Paper CC43 Give me EVERYTHING! A macro to combine the CONTENTS procedure output and formats. Lynn Mullins, PPD, Cincinnati, Ohio ABSTRACT The PROC CONTENTS output displays SAS data set

More information

An Easy Route to a Missing Data Report with ODS+PROC FREQ+A Data Step Mike Zdeb, FSL, University at Albany School of Public Health, Rensselaer, NY

An Easy Route to a Missing Data Report with ODS+PROC FREQ+A Data Step Mike Zdeb, FSL, University at Albany School of Public Health, Rensselaer, NY SESUG 2016 Paper BB-170 An Easy Route to a Missing Data Report with ODS+PROC FREQ+A Data Step Mike Zdeb, FSL, University at Albany School of Public Health, Rensselaer, NY ABSTRACT A first step in analyzing

More information

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS TO SAS NEED FOR SAS WHO USES SAS WHAT IS SAS? OVERVIEW OF BASE SAS SOFTWARE DATA MANAGEMENT FACILITY STRUCTURE OF SAS DATASET SAS PROGRAM PROGRAMMING LANGUAGE ELEMENTS OF THE SAS LANGUAGE RULES FOR SAS

More information

Efficient Processing of Long Lists of Variable Names

Efficient Processing of Long Lists of Variable Names Efficient Processing of Long Lists of Variable Names Paulette W. Staum, Paul Waldron Consulting, West Nyack, NY ABSTRACT Many programmers use SAS macro language to manipulate lists of variable names. They

More information

Procedure for Stamping Source File Information on SAS Output Elizabeth Molloy & Breda O'Connor, ICON Clinical Research

Procedure for Stamping Source File Information on SAS Output Elizabeth Molloy & Breda O'Connor, ICON Clinical Research Procedure for Stamping Source File Information on SAS Output Elizabeth Molloy & Breda O'Connor, ICON Clinical Research ABSTRACT In the course of producing a report for a clinical trial numerous drafts

More information

Using SAS software to fulfil an FDA request for database documentation

Using SAS software to fulfil an FDA request for database documentation Using SAS software to fulfil an FDA request for database documentation Introduction Pantaleo Nacci, Adam Crisp Glaxo Wellcome R&D, UK Historically, a regulatory submission to seek approval for a new drug

More information

Intermediate SAS: Working with Data

Intermediate SAS: Working with Data Intermediate SAS: Working with Data OIT Technical Support Services 293-4444 oithelp@mail.wvu.edu oit.wvu.edu/training/classmat/sas/ Table of Contents Getting set up for the Intermediate SAS workshop:...

More information

An Easier and Faster Way to Untranspose a Wide File

An Easier and Faster Way to Untranspose a Wide File Paper 2419-2018 An Easier and Faster Way to Untranspose a Wide File Arthur S. Tabachneck, Ph.D., AnalystFinder, Inc. Matthew Kastin, NORC at the University of Chicago Joe Matise, NORC at the University

More information

ABSTRACT INTRODUCTION MACRO. Paper RF

ABSTRACT INTRODUCTION MACRO. Paper RF Paper RF-08-2014 Burst Reporting With the Help of PROC SQL Dan Sturgeon, Priority Health, Grand Rapids, Michigan Erica Goodrich, Priority Health, Grand Rapids, Michigan ABSTRACT Many SAS programmers need

More information

Abstract. Introduction. How Are All of These Tables Related? - Relational Database Map - RDB_MAP.SAS

Abstract. Introduction. How Are All of These Tables Related? - Relational Database Map - RDB_MAP.SAS How Are All of These Tables Related? - Relational Database Map - RDB_MAPSAS Eric Losby, HealthCare COMPARE Corp, Downers Grove, IL Abstract This simple, yet highly useful SAS program generates a "relational

More information

3. Almost always use system options options compress =yes nocenter; /* mostly use */ options ps=9999 ls=200;

3. Almost always use system options options compress =yes nocenter; /* mostly use */ options ps=9999 ls=200; Randy s SAS hints, updated Feb 6, 2014 1. Always begin your programs with internal documentation. * ***************** * Program =test1, Randy Ellis, first version: March 8, 2013 ***************; 2. Don

More information

How to Create Data-Driven Lists

How to Create Data-Driven Lists Paper 9540-2016 How to Create Data-Driven Lists Kate Burnett-Isaacs, Statistics Canada ABSTRACT As SAS programmers we often want our code or program logic to be driven by the data at hand, rather than

More information

Paper B GENERATING A DATASET COMPRISED OF CUSTOM FORMAT DETAILS

Paper B GENERATING A DATASET COMPRISED OF CUSTOM FORMAT DETAILS Paper B07-2009 Eliminating Redundant Custom Formats (or How to Really Take Advantage of Proc SQL, Proc Catalog, and the Data Step) Philip A. Wright, University of Michigan, Ann Arbor, MI ABSTRACT Custom

More information

SD10 A SAS MACRO FOR PERFORMING BACKWARD SELECTION IN PROC SURVEYREG

SD10 A SAS MACRO FOR PERFORMING BACKWARD SELECTION IN PROC SURVEYREG Paper SD10 A SAS MACRO FOR PERFORMING BACKWARD SELECTION IN PROC SURVEYREG Qixuan Chen, University of Michigan, Ann Arbor, MI Brenda Gillespie, University of Michigan, Ann Arbor, MI ABSTRACT This paper

More information

Implementing external file processing with no record delimiter via a metadata-driven approach

Implementing external file processing with no record delimiter via a metadata-driven approach Paper 2643-2018 Implementing external file processing with no record delimiter via a metadata-driven approach Princewill Benga, F&P Consulting, Saint-Maur, France ABSTRACT Most of the time, we process

More information

Adjusting for daylight saving times. PhUSE Frankfurt, 06Nov2018, Paper CT14 Guido Wendland

Adjusting for daylight saving times. PhUSE Frankfurt, 06Nov2018, Paper CT14 Guido Wendland Adjusting for daylight saving times PhUSE Frankfurt, 06Nov2018, Paper CT14 Guido Wendland 1. The problem Page Introduction: DST (Daylight saving times) around the world 2 nd Sunday in March 1 st Sunday

More information

SAS Certification Handout #10: Adv. Prog. Ch. 5-8

SAS Certification Handout #10: Adv. Prog. Ch. 5-8 SAS Certification Handout #10: Adv. Prog. Ch. 5-8 /************ Ch. 5 ******************* /* First, make example data -- same as Handout #9 libname cert 'C:/jrstevens/Teaching/SAS_Cert/AdvNotes'; /* In

More information

Dictionary.coumns is your friend while appending or moving data

Dictionary.coumns is your friend while appending or moving data ABSTRACT SESUG Paper CC-41-2017 Dictionary.coumns is your friend while appending or moving data Kiran Venna, Dataspace Inc. Dictionary.columns is a dictionary table, which gives metadata information of

More information

Data Quality Review for Missing Values and Outliers

Data Quality Review for Missing Values and Outliers Paper number: PH03 Data Quality Review for Missing Values and Outliers Ying Guo, i3, Indianapolis, IN Bradford J. Danner, i3, Lincoln, NE ABSTRACT Before performing any analysis on a dataset, it is often

More information

%MAKE_IT_COUNT: An Example Macro for Dynamic Table Programming Britney Gilbert, Juniper Tree Consulting, Porter, Oklahoma

%MAKE_IT_COUNT: An Example Macro for Dynamic Table Programming Britney Gilbert, Juniper Tree Consulting, Porter, Oklahoma Britney Gilbert, Juniper Tree Consulting, Porter, Oklahoma ABSTRACT Today there is more pressure on programmers to deliver summary outputs faster without sacrificing quality. By using just a few programming

More information

Identifying Duplicate Variables in a SAS Data Set

Identifying Duplicate Variables in a SAS Data Set Paper 1654-2018 Identifying Duplicate Variables in a SAS Data Set Bruce Gilsen, Federal Reserve Board, Washington, DC ABSTRACT In the big data era, removing duplicate data from a data set can reduce disk

More information

Conversion of CDISC specifications to CDISC data specifications driven SAS programming for CDISC data mapping

Conversion of CDISC specifications to CDISC data specifications driven SAS programming for CDISC data mapping PharmaSUG 2017 - Paper DA03 Conversion of CDISC specifications to CDISC data specifications driven SAS programming for CDISC data mapping Yurong Dai, Jiangang Jameson Cai, Eli Lilly and Company ABSTRACT

More information

SUAVe Open Problem (May 8 th 2018 meeting)

SUAVe Open Problem (May 8 th 2018 meeting) SUAVe Open Problem (May 8 th 2018 meeting) For this Open Problem, you are given a list of people and the set of (ICD9) diagnoses coded for each person by one or more physicians within a 12 month period.

More information

Create Metadata Documentation using ExcelXP

Create Metadata Documentation using ExcelXP Paper AD13 Create Metadata Documentation using ExcelXP Christine Teng, Merck Research Labs, Merck & Co., Inc., Rahway, NJ ABSTRACT The purpose of the metadata documentation is two-fold. First, it facilitates

More information

Better Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables

Better Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables Paper 3458-2015 Better Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables ABSTRACT Louise Hadden, Abt Associates Inc., Cambridge, MA SAS provides a wealth of resources for users to

More information

So Much Data, So Little Time: Splitting Datasets For More Efficient Run Times and Meeting FDA Submission Guidelines

So Much Data, So Little Time: Splitting Datasets For More Efficient Run Times and Meeting FDA Submission Guidelines Paper TT13 So Much Data, So Little Time: Splitting Datasets For More Efficient Run Times and Meeting FDA Submission Guidelines Anthony Harris, PPD, Wilmington, NC Robby Diseker, PPD, Wilmington, NC ABSTRACT

More information

Quick Data Definitions Using SQL, REPORT and PRINT Procedures Bradford J. Danner, PharmaNet/i3, Tennessee

Quick Data Definitions Using SQL, REPORT and PRINT Procedures Bradford J. Danner, PharmaNet/i3, Tennessee ABSTRACT PharmaSUG2012 Paper CC14 Quick Data Definitions Using SQL, REPORT and PRINT Procedures Bradford J. Danner, PharmaNet/i3, Tennessee Prior to undertaking analysis of clinical trial data, in addition

More information

TOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE

TOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE TOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE Handy Tips for the Savvy Programmer SAS PROGRAMMING BEST PRACTICES Create Readable Code Basic Coding Recommendations» Efficiently choosing data for processing»

More information

SAS Macro Language: Reference

SAS Macro Language: Reference SAS Macro Language: Reference INTRODUCTION Getting Started with the Macro Facility This is the macro facility language reference for the SAS System. It is a reference for the SAS macro language processor

More information

A Cross-national Comparison Using Stacked Data

A Cross-national Comparison Using Stacked Data A Cross-national Comparison Using Stacked Data Goal In this exercise, we combine household- and person-level files across countries to run a regression estimating the usual hours of the working-aged civilian

More information

Base and Advance SAS

Base and Advance SAS Base and Advance SAS BASE SAS INTRODUCTION An Overview of the SAS System SAS Tasks Output produced by the SAS System SAS Tools (SAS Program - Data step and Proc step) A sample SAS program Exploring SAS

More information

PhUSE Paper CC07. Slim Down Your Data. Mickael Borne, 4Clinics, Montpellier, France

PhUSE Paper CC07. Slim Down Your Data. Mickael Borne, 4Clinics, Montpellier, France Paper CC07 Slim Down Your Data Mickael Borne, 4Clinics, Montpellier, France ABSTRACT We developed a package of SAS macro-programs that was developed to automatically resize character variables of all SAS

More information

Introduction. Getting Started with the Macro Facility CHAPTER 1

Introduction. Getting Started with the Macro Facility CHAPTER 1 1 CHAPTER 1 Introduction Getting Started with the Macro Facility 1 Replacing Text Strings Using Macro Variables 2 Generating SAS Code Using Macros 3 Inserting Comments in Macros 4 Macro Definition Containing

More information

WHAT ARE SASHELP VIEWS?

WHAT ARE SASHELP VIEWS? Paper PN13 There and Back Again: Navigating between a SASHELP View and the Real World Anita Rocha, Center for Studies in Demography and Ecology University of Washington, Seattle, WA ABSTRACT A real strength

More information

Greenspace: A Macro to Improve a SAS Data Set Footprint

Greenspace: A Macro to Improve a SAS Data Set Footprint Paper AD-150 Greenspace: A Macro to Improve a SAS Data Set Footprint Brian Varney, Experis Business Intelligence and Analytics Practice ABSTRACT SAS programs can be very I/O intensive. SAS data sets with

More information

Coders' Corner. Scaling Mount GCHART: Using a MACRO to Dynamically Reset the Scale Nina L. Werner, Dean Health Plan, Inc., Madison, WI.

Coders' Corner. Scaling Mount GCHART: Using a MACRO to Dynamically Reset the Scale Nina L. Werner, Dean Health Plan, Inc., Madison, WI. Paper 111-25 Scaling Mount GCHART: Using a MACRO to Dynamically Reset the Scale Nina L. Werner, Dean Health Plan, Inc., Madison, WI ABSTRACT If you do not set the scale yourself, PROC GCHART will automatically

More information

Building Sequential Programs for a Routine Task with Five SAS Techniques

Building Sequential Programs for a Routine Task with Five SAS Techniques ABSTRACT SESUG Paper BB-139-2017 Building Sequential Programs for a Routine Task with Five SAS Techniques Gongmei Yu and Paul LaBrec, 3M Health Information Systems. When a task needs to be implemented

More information

SAS 101. Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23. By Tasha Chapman, Oregon Health Authority

SAS 101. Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23. By Tasha Chapman, Oregon Health Authority SAS 101 Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23 By Tasha Chapman, Oregon Health Authority Topics covered All the leftovers! Infile options Missover LRECL=/Pad/Truncover

More information

Top 10 SAS Functions in A brief summary of SAS Communities Survey - by Flora Fang Liu

Top 10 SAS Functions in A brief summary of SAS Communities Survey - by Flora Fang Liu Top 10 SAS Functions in 2017 A brief summary of SAS Communities Survey - by Flora Fang Liu 1 What are SAS Functions? Why use SAS Functions? What? SAS functions perform computations, data manipulation,

More information

PhUSE US Connect 2018 Paper CT06 A Macro Tool to Find and/or Split Variable Text String Greater Than 200 Characters for Regulatory Submission Datasets

PhUSE US Connect 2018 Paper CT06 A Macro Tool to Find and/or Split Variable Text String Greater Than 200 Characters for Regulatory Submission Datasets PhUSE US Connect 2018 Paper CT06 A Macro Tool to Find and/or Split Variable Text String Greater Than 200 Characters for Regulatory Submission Datasets Venkata N Madhira, Shionogi Inc, Florham Park, USA

More information

Top-Down Programming with SAS Macros Edward Heaton, Westat, Rockville, MD

Top-Down Programming with SAS Macros Edward Heaton, Westat, Rockville, MD Paper P813 Top-Down Programming with SAS Macros Edward Heaton, Westat, Rockville, MD ABSTRACT Structured, top-down programming techniques are not intuitively obvious in the SAS language, but macros can

More information

MOBILE MACROS GET UP TO SPEED SOMEWHERE NEW FAST Author: Patricia Hettinger, Data Analyst Consultant Oakbrook Terrace, IL

MOBILE MACROS GET UP TO SPEED SOMEWHERE NEW FAST Author: Patricia Hettinger, Data Analyst Consultant Oakbrook Terrace, IL MOBILE MACROS GET UP TO SPEED SOMEWHERE NEW FAST Author: Patricia Hettinger, Data Analyst Consultant Oakbrook Terrace, IL ABSTRACT: Have you ever been faced with this scenario? It s your first day on the

More information

Deep Dive: Pronto Transformations Reference

Deep Dive: Pronto Transformations Reference Deep Dive: Pronto Transformations Reference Available Transformations and Their Icons Transform Description Menu Icon Add Column on page 2 Important: Not available in Trial. Upgrade to Pro Edition! Add

More information

Top 5 Handy PROC SQL Tips You Didn t Think Were Possible

Top 5 Handy PROC SQL Tips You Didn t Think Were Possible Top 5 Handy PROC SQL Tips You Didn t Think Were Possible Montreal SAS users Group 30 May 2018 11:00-11:40 Charu Shankar SAS Institute, Toronto About your presenter SAS Senior Technical Training Specialist,

More information

Macro to compute best transform variable for the model

Macro to compute best transform variable for the model Paper 3103-2015 Macro to compute best transform variable for the model Nancy Hu, Discover Financial Service ABSTRACT This study is intended to assist Analysts to generate the best of variables using simple

More information

footnote1 height=8pt j=l "(Rev. &sysdate)" j=c "{\b\ Page}{\field{\*\fldinst {\b\i PAGE}}}";

footnote1 height=8pt j=l (Rev. &sysdate) j=c {\b\ Page}{\field{\*\fldinst {\b\i PAGE}}}; Producing an Automated Data Dictionary as an RTF File (or a Topic to Bring Up at a Party If You Want to Be Left Alone) Cyndi Williamson, SRI International, Menlo Park, CA ABSTRACT Data dictionaries are

More information

KEPT IN TRANSLATION: AVOIDING DATA LOSS AND OTHER PROBLEMS WHEN CONVERTING JAPANESE DATA

KEPT IN TRANSLATION: AVOIDING DATA LOSS AND OTHER PROBLEMS WHEN CONVERTING JAPANESE DATA PAPER TS05 KEPT IN TRANSLATION: AVOIDING DATA LOSS AND OTHER PROBLEMS WHEN CONVERTING JAPANESE DATA Steve Prust, Covance, Leeds, UK ABSTRACT This paper details a method of translating and converting data

More information

ERROR: ERROR: ERROR:

ERROR: ERROR: ERROR: ERROR: ERROR: ERROR: Formatting Variables: Back and forth between character and numeric Why should you care? DATA name1; SET name; if var = Three then delete; if var = 3 the en delete; if var = 3 then

More information

Essential ODS Techniques for Creating Reports in PDF Patrick Thornton, SRI International, Menlo Park, CA

Essential ODS Techniques for Creating Reports in PDF Patrick Thornton, SRI International, Menlo Park, CA Thornton, S. P. (2006). Essential ODS techniques for creating reports in PDF. Paper presented at the Fourteenth Annual Western Users of the SAS Software Conference, Irvine, CA. Essential ODS Techniques

More information

Automated Checking Of Multiple Files Kathyayini Tappeta, Percept Pharma Services, Bridgewater, NJ

Automated Checking Of Multiple Files Kathyayini Tappeta, Percept Pharma Services, Bridgewater, NJ PharmaSUG 2015 - Paper QT41 Automated Checking Of Multiple Files Kathyayini Tappeta, Percept Pharma Services, Bridgewater, NJ ABSTRACT Most often clinical trial data analysis has tight deadlines with very

More information

Same Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI

Same Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI Paper BB-02-2013 Same Data Different Attributes: Cloning Issues with Data Sets Brian Varney, Experis Business Analytics, Portage, MI ABSTRACT When dealing with data from multiple or unstructured data sources,

More information

General Tips for Working with Large SAS datasets and Oracle tables

General Tips for Working with Large SAS datasets and Oracle tables General Tips for Working with Large SAS datasets and Oracle tables 1) Avoid duplicating Oracle tables as SAS datasets only keep the rows and columns needed for your analysis. Use keep/drop/where directly

More information

Cody s Collection of Popular SAS Programming Tasks and How to Tackle Them

Cody s Collection of Popular SAS Programming Tasks and How to Tackle Them Cody s Collection of Popular SAS Programming Tasks and How to Tackle Them Ron Cody Contents List of Programs... ix About This Book... xv About The Author... xix Acknowledgments... xxi Chapter 1 Tasks Involving

More information

Tweaking your tables: Suppressing superfluous subtotals in PROC TABULATE

Tweaking your tables: Suppressing superfluous subtotals in PROC TABULATE ABSTRACT Tweaking your tables: Suppressing superfluous subtotals in PROC TABULATE Steve Cavill, NSW Bureau of Crime Statistics and Research, Sydney, Australia PROC TABULATE is a great tool for generating

More information

Data Manipulation with SQL Mara Werner, HHS/OIG, Chicago, IL

Data Manipulation with SQL Mara Werner, HHS/OIG, Chicago, IL Paper TS05-2011 Data Manipulation with SQL Mara Werner, HHS/OIG, Chicago, IL Abstract SQL was developed to pull together information from several different data tables - use this to your advantage as you

More information

2. Don t forget semicolons and RUN statements The two most common programming errors.

2. Don t forget semicolons and RUN statements The two most common programming errors. Randy s SAS hints March 7, 2013 1. Always begin your programs with internal documentation. * ***************** * Program =test1, Randy Ellis, March 8, 2013 ***************; 2. Don t forget semicolons and

More information

A SAS Macro for Producing Benchmarks for Interpreting School Effect Sizes

A SAS Macro for Producing Benchmarks for Interpreting School Effect Sizes A SAS Macro for Producing Benchmarks for Interpreting School Effect Sizes Brian E. Lawton Curriculum Research & Development Group University of Hawaii at Manoa Honolulu, HI December 2012 Copyright 2012

More information

A Macro that can Search and Replace String in your SAS Programs

A Macro that can Search and Replace String in your SAS Programs ABSTRACT MWSUG 2016 - Paper BB27 A Macro that can Search and Replace String in your SAS Programs Ting Sa, Cincinnati Children s Hospital Medical Center, Cincinnati, OH In this paper, a SAS macro is introduced

More information

David Ghan SAS Education

David Ghan SAS Education David Ghan SAS Education 416 307-4515 David.ghan@sas.com Using SQL in SAS Victoria Area SAS User Group February 12, 2004 1. What is SQL? 2. Coding an SQL Query 3. Advanced Examples a. Creating macro variables

More information

So, Your Data are in Excel! Ed Heaton, Westat

So, Your Data are in Excel! Ed Heaton, Westat Paper AD02_05 So, Your Data are in Excel! Ed Heaton, Westat Abstract You say your customer sent you the data in an Excel workbook. Well then, I guess you'll have to work with it. This paper will discuss

More information

Using SAS Macro to Include Statistics Output in Clinical Trial Summary Table

Using SAS Macro to Include Statistics Output in Clinical Trial Summary Table Using SAS Macro to Include Statistics Output in Clinical Trial Summary Table Amy C. Young, Ischemia Research and Education Foundation, San Francisco, CA Sharon X. Zhou, Ischemia Research and Education

More information

Seminar Series: CTSI Presents

Seminar Series: CTSI Presents Biostatistics, Epidemiology & Research Design (BERD) Howard Cabral, PhD, MPH Christine Chaisson, MPH Seminar Series: CTSI Presents November 20, 2014 Demystifying SAS Macros BUSPH Data Coordinating Center

More information

Why choose between SAS Data Step and PROC SQL when you can have both?

Why choose between SAS Data Step and PROC SQL when you can have both? Paper QT-09 Why choose between SAS Data Step and PROC SQL when you can have both? Charu Shankar, SAS Canada ABSTRACT As a SAS coder, you've often wondered what the SQL buzz is about. Or vice versa you

More information

Chapter 1. Introduction. 1.1 More about SQL More about This Book 5

Chapter 1. Introduction. 1.1 More about SQL More about This Book 5 Chapter 1 Introduction 1.1 More about SQL 2 1.2 More about This Book 5 SAS defines Structured Query Language (SQL) as a standardized, widely used language that retrieves data from and updates data in tables

More information

22S:166. Checking Values of Numeric Variables

22S:166. Checking Values of Numeric Variables 22S:1 Computing in Statistics Lecture 24 Nov. 2, 2016 1 Checking Values of Numeric Variables range checks when you know what the range of possible values is for a given quantitative variable internal consistency

More information

DBLOAD Procedure Reference

DBLOAD Procedure Reference 131 CHAPTER 10 DBLOAD Procedure Reference Introduction 131 Naming Limits in the DBLOAD Procedure 131 Case Sensitivity in the DBLOAD Procedure 132 DBLOAD Procedure 132 133 PROC DBLOAD Statement Options

More information

Mapping Clinical Data to a Standard Structure: A Table Driven Approach

Mapping Clinical Data to a Standard Structure: A Table Driven Approach ABSTRACT Paper AD15 Mapping Clinical Data to a Standard Structure: A Table Driven Approach Nancy Brucken, i3 Statprobe, Ann Arbor, MI Paul Slagle, i3 Statprobe, Ann Arbor, MI Clinical Research Organizations

More information

Using SAS/SCL to Create Flexible Programs... A Super-Sized Macro Ellen Michaliszyn, College of American Pathologists, Northfield, IL

Using SAS/SCL to Create Flexible Programs... A Super-Sized Macro Ellen Michaliszyn, College of American Pathologists, Northfield, IL Using SAS/SCL to Create Flexible Programs... A Super-Sized Macro Ellen Michaliszyn, College of American Pathologists, Northfield, IL ABSTRACT SAS is a powerful programming language. When you find yourself

More information

Prove QC Quality Create SAS Datasets from RTF Files Honghua Chen, OCKHAM, Cary, NC

Prove QC Quality Create SAS Datasets from RTF Files Honghua Chen, OCKHAM, Cary, NC Prove QC Quality Create SAS Datasets from RTF Files Honghua Chen, OCKHAM, Cary, NC ABSTRACT Since collecting drug trial data is expensive and affects human life, the FDA and most pharmaceutical company

More information

PharmaSUG Paper TT11

PharmaSUG Paper TT11 PharmaSUG 2014 - Paper TT11 What is the Definition of Global On-Demand Reporting within the Pharmaceutical Industry? Eric Kammer, Novartis Pharmaceuticals Corporation, East Hanover, NJ ABSTRACT It is not

More information

Programming & Manipulation. Danger: MERGE Ahead! Warning: BY Variable with Multiple Lengths! Bob Virgile Robert Virgile Associates, Inc.

Programming & Manipulation. Danger: MERGE Ahead! Warning: BY Variable with Multiple Lengths! Bob Virgile Robert Virgile Associates, Inc. Danger: MERGE Ahead! Warning: BY Variable with Multiple Lengths! Bob Virgile Robert Virgile Associates, Inc. Overview Normally, when a data step merges two data sets, any common variables will have the

More information

Planting Your Rows: Using SAS Formats to Make the Generation of Zero- Filled Rows in Tables Less Thorny

Planting Your Rows: Using SAS Formats to Make the Generation of Zero- Filled Rows in Tables Less Thorny Planting Your Rows: Using SAS Formats to Make the Generation of Zero- Filled Rows in Tables Less Thorny Kathy Hardis Fraeman, United BioSource Corporation, Bethesda, MD ABSTRACT Often tables or summary

More information

Reading in Data Directly from Microsoft Word Questionnaire Forms

Reading in Data Directly from Microsoft Word Questionnaire Forms Paper 1401-2014 Reading in Data Directly from Microsoft Word Questionnaire Forms Sijian Zhang, VA Pittsburgh Healthcare System ABSTRACT If someone comes to you with hundreds of questionnaire forms in Microsoft

More information

Automatic Indicators for Dummies: A macro for generating dummy indicators from category type variables

Automatic Indicators for Dummies: A macro for generating dummy indicators from category type variables MWSUG 2018 - Paper AA-29 Automatic Indicators for Dummies: A macro for generating dummy indicators from category type variables Matthew Bates, Affusion Consulting, Columbus, OH ABSTRACT Dummy Indicators

More information

V for Variable Information Functions to the Rescue

V for Variable Information Functions to the Rescue ABSTRACT V for Variable Information Functions to the Rescue Richann Watson, DataRich Consulting Karl Miller, Syneos Health There are times when we need to use the attributes of a variable within a data

More information

Paper S Data Presentation 101: An Analyst s Perspective

Paper S Data Presentation 101: An Analyst s Perspective Paper S1-12-2013 Data Presentation 101: An Analyst s Perspective Deanna Chyn, University of Michigan, Ann Arbor, MI Anca Tilea, University of Michigan, Ann Arbor, MI ABSTRACT You are done with the tedious

More information

Paper CC16. William E Benjamin Jr, Owl Computer Consultancy LLC, Phoenix, AZ

Paper CC16. William E Benjamin Jr, Owl Computer Consultancy LLC, Phoenix, AZ Paper CC16 Smoke and Mirrors!!! Come See How the _INFILE_ Automatic Variable and SHAREBUFFERS Infile Option Can Speed Up Your Flat File Text-Processing Throughput Speed William E Benjamin Jr, Owl Computer

More information

The Dataset Diet How to transform short and fat into long and thin

The Dataset Diet How to transform short and fat into long and thin Paper TU06 The Dataset Diet How to transform short and fat into long and thin Kathryn Wright, Oxford Pharmaceutical Sciences, UK ABSTRACT What do you do when you are given a dataset with one observation

More information

Widefiles, Deepfiles, and the Fine Art of Macro Avoidance Howard L. Kaplan, Ventana Clinical Research Corporation, Toronto, ON

Widefiles, Deepfiles, and the Fine Art of Macro Avoidance Howard L. Kaplan, Ventana Clinical Research Corporation, Toronto, ON Paper 177-29 Widefiles, Deepfiles, and the Fine Art of Macro Avoidance Howard L. Kaplan, Ventana Clinical Research Corporation, Toronto, ON ABSTRACT When data from a collection of datasets (widefiles)

More information

A SAS Macro for Balancing a Weighted Sample

A SAS Macro for Balancing a Weighted Sample Paper 258-25 A SAS Macro for Balancing a Weighted Sample David Izrael, David C. Hoaglin, and Michael P. Battaglia Abt Associates Inc., Cambridge, Massachusetts Abstract It is often desirable to adjust

More information

Paper CC06. a seed number for the random number generator, a prime number is recommended

Paper CC06. a seed number for the random number generator, a prime number is recommended Paper CC06 %ArrayPerm: A SAS Macro for Permutation Analysis of Microarray Data Deqing Pei, M.S., Wei Liu, M.S., Cheng Cheng, Ph.D. St. Jude Children s Research Hospital, Memphis, TN ABSTRACT Microarray

More information

Using Templates Created by the SAS/STAT Procedures

Using Templates Created by the SAS/STAT Procedures Paper 081-29 Using Templates Created by the SAS/STAT Procedures Yanhong Huang, Ph.D. UMDNJ, Newark, NJ Jianming He, Solucient, LLC., Berkeley Heights, NJ ABSTRACT SAS procedures provide a large quantity

More information

EXAMPLE 3: MATCHING DATA FROM RESPONDENTS AT 2 OR MORE WAVES (LONG FORMAT)

EXAMPLE 3: MATCHING DATA FROM RESPONDENTS AT 2 OR MORE WAVES (LONG FORMAT) EXAMPLE 3: MATCHING DATA FROM RESPONDENTS AT 2 OR MORE WAVES (LONG FORMAT) DESCRIPTION: This example shows how to combine the data on respondents from the first two waves of Understanding Society into

More information

SAS Graphs in Small Multiples Andrea Wainwright-Zimmerman, Capital One, Richmond, VA

SAS Graphs in Small Multiples Andrea Wainwright-Zimmerman, Capital One, Richmond, VA Paper SIB-113 SAS Graphs in Small Multiples Andrea Wainwright-Zimmerman, Capital One, Richmond, VA ABSTRACT Edward Tufte has championed the idea of using "small multiples" as an effective way to present

More information

Electricity Forecasting Full Circle

Electricity Forecasting Full Circle Electricity Forecasting Full Circle o Database Creation o Libname Functionality with Excel o VBA Interfacing Allows analysts to develop procedural prototypes By: Kyle Carmichael Disclaimer The entire presentation

More information