Developing Data-Driven SAS Programs Using Proc Contents

Size: px
Start display at page:

Download "Developing Data-Driven SAS Programs Using Proc Contents"

Transcription

1 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 without being modified. Such programs are referred to as data-driven programs because they assess the structure of the data set they are working with and automatically adapt to that structure. In SAS, the macro language can be used in conjunction with PROC CONTENTS to produce such programs. In this paper examples are provided to illustrate how this technique can be used to reduce programming and maintenance effort in a variety of situations. This paper is intended for experienced SAS programmers who have a basic understanding of the SAS macro language. INTRODUCTION The SAS macro language provides powerful capabilities for writing flexible programs that can behave differently depending on the parameters passed to them. A common use of macros is to reduce repetition in programs. An example from the pharmaceutical industry is the need to produce summary listing for each subject with the subject ID included in the report title. To accomplish this, you could write PROC REPORT code and make a copy for each subject then change the ID in each title statement. A more efficient way would be to put the PROC REPORT code in a macro, pass subject ID as a parameter and then use macro variable substitution to place the ID in the title. This method is simple when there are only a few differences between each report, but what do you do when you need reports for many different data sets with different structures? PROC CONTENTS provides a simple solution with its capability of storing data set structure information in a data set. This information can then be stored in macro variables and used to build SAS programming statements tailored to the data set you are working with. For example, in PROC REPORT, the variable names could be used to construct the COLUMN statements. In addition to making your program more generic, you also eliminate many errors. Because the variable names are obtained from PROC CONTENTS, you are assured that all variables will be included and that they will all be spelled correctly. Information on type, length, label and format can be used in a similar fashion to produce a DEFINE statement for each variable. This method can be used to generate SAS programming statements for any SAS procedure that utilizes data set structure information. There are two basic ways in which this process can be used in your programs. The first is to use macro variable substitution in the source code run by your current session. This has the advantage that your program can be generic and self contained. The second method is to use a DATA _NULL_ step with a series of PUT statements that use macro variable substitution to create a text file containing SAS source code statements. An advantage of this method is that you can modify the program before you run it. This is helpful when you are not able to handle all coding needs in your macro. It also allows you to give the source code to clients without giving away your macro technology. METHOD PROC CONTENTS has several features that make it useful in developing data-driven applications. It can determine the structure of any data set in a SAS library by using the DATA= LIBNAME.MEMBER option or it can process all data sets in a library at once by specifying DATA= LIBNAME._ALL_. By using the OUT= LIBNAME.MEMBER and NOPRINT options you can send the output to a SAS data set and suppress printed output. The resulting data set contains a series of variables describing the data set structures with an observation for each variable in each data set. The most useful variables are listed below. PROC CONTENTS Variable LIBNAME MEMNAME NAME TYPE LENGTH LABEL FORMAT FORMATL FORMATD INFORMAT INFORMATL IINFORMATD Description SAS Library Name SAS Library Member Name Variable Name Variable Type (1= numeric, 2= character) Variable length Variable Label Variable Format Format Length Format Decimals Variable Informat Informat Length Informat Decimals Creating a structure data set is very simple, an example is given below. proc contents data= &saslib..&ds out=struct position noprint; The macro variables that indicate the SAS library and data set name to be used are passed as parameters to the macro that contains the call to PROC CONTENTS. The PROC CONTENTS output is stored in a temporary data set called struct. The position option specifies that the observations will be ordered by the location of variables

2 in the data set rather than alphabetically by variable name. The NOPRINT option suppresses printed output of the PROC CONTENTS results. The next step is to place the desired information into SAS macro variables. Because these variables are often used in iterative processes, it is desirable to have them in an array. While the SAS macro language does not support arrays, you can simulate arrays (sometimes called pseudo arrays) by using multi-pass macro variable resolution. The following source code creates a pseudo array containing the variable names and types from the data set struct. The SYMPUT function is used to store the data set variables NAME and TYPE into macro variables that have the observation number added to the end of variable name (e.g. var1, var2, etc.) to facilitate referencing them in a %DO loop. The last observation number is stored as well to serve as the upper limit for the %DO loop. set struct end=last; call symput('var' left(_n_), name); call symput('type' left(_n_),type); if last then call symput('numrec', _N_); As mentioned earlier, one use of this information is to use macro variable substitution to form the necessary SAS source code when the macro is resolved. The following example loops through all variables in the data set and calls PROC FREQ for each one. %do i = 1 %to &numrec; proc freq data= &saslib..&ds; tables &&var&i; % The macro variable reference &&var&i will be resolved in two passes. When I = 1, the first pass will resolve to &var1 and the second pass will resolve to the string stored in &var1 which will be the name of the first variable in the data set. Another option is to use a DATA _NULL_ step and PUT statements to generate SAS source code. The example below uses this method to generate PROC REPORT code. The source code is put in the text file referenced in the FILE statements. The MOD option is used so that each successive DATA step will append to the file rather than overwrite it. set struct end=last; file sascode mod; if _N_ = 1 then do; put / "proc report data=&saslib..&ds missing nowindows headline headskip split='\';"/ ' column linelen + length(name); if linelen >= 70 then do; put / linelen = 10; put if last then put ';'; set struct end=last; file sascode mod; length clabel $ 120 coltype $ 7; vnwidth = length( trim(name)); if name in('patno','visit') then coltype = 'order'; else coltype = 'display'; select; when(length <= 4) clabel = "define " name " / " coltype " width=" put( max(vnwidth, 4), 2.) "left;"; when(4 < length <= 20) clabel = "define " name " / " coltype " width=" put( max(vnwidth, length), 2.) " left;"; when(length > 20) clabel = "define " name " / " coltype " width=20" " left flow;"; clabel; if last then do; put " title1 'QC Listing Report for &ds';" / '';

3 To start the program generation, a PROC REPORT statement and the associated options are written. Because this is only needs to be done once, before the variablespecific statements are written, an IF statement is used so that this line is only written when _N_ equals one. The macro variables &SASLIB and &DS contain the SAS library name and the data set name. Because these macro variables need to be resolved as the source code is generated, double quotes are used to surround the string that contains them. If you need to include a macro variable reference in the source code you generate, use single quotes to enclose the string. The remaining statements in this DATA step are used to create a COLUMN statement that contains the names of all the variables in the data set to be reported from. The second DATA step is used to create DEFINE statements for each column. This section illustrates how conditional processing can be used to generate source code that is dependent on each variable s attributes. When the length of a variable is less than or equal to four, the column width is set to the maximum of the length of the variable name and four. This guarantees that you will not have any columns narrower than four spaces. When the length is greater than four, but less than or equal to 20, the column width is equal to the maximum of the length of the name and the length of the variable. When the length is greater than 20, the column width is set to 20 and the FLOW option is used for column wrapping. After the last variable is reached, a TITLE statement is generated. This source code is part of a macro that receives the data set name in the parameter DS. If you need to perform generate source code for multiple data sets, you can write another macro that creates a pseudo array containing the names of the required data sets and then calls the source code generating macro for each data set. An example of such a macro is given below. %macro qcrptgen (saslib, codefile); options nolabel nofmterr; filename sascode "&codefile"; /**** CREATE PROGRAM HEADER ****/ file sascode mod; gendate = put( today(), date9.); put "/***********************"; put " QC Listing for: &saslib"; put " Program name :: &codefile"; put " Authors name :: "; put " Date started :: " gendate /; put " Source code generated by the ; put QCList Macro."; put "******************************/"; /**** CREATE A DATASET CONTAINING THE NAMES OF ALL DATASETS IN THE LIBRARY SASLIB ****/ proc contents data=&saslib.._all_ out = libmem (keep= memname varnum) position noprint; proc sort data=libmem nodupkey; by memname; /**** CREATE A PSUEDO-ARRAY (D1..Dn) OF MACRO VARIABLES CONTAINING EACH DATASET NAME ****/ set libmem end=last; call symput('d' left(_n_), memname); if last then call symput('numrec', _N_); /**** CALL THE SOURCE CODE GENERATOR FOR EACH DATASET ****/ %do i = 1 %to &numrec; %prgen(&&d&i); % %mend qcrptgen; This macro has two parameters; SASLIB, which contains the name of the SAS library to use, and CODEFILE, which contains the full path and filename of the source code file you want to create. The first DATA step generates a program header. The next step uses PROC CONTENTS to create a data set that contains the data structure information for all data sets in the specified SAS library. The purpose of this data set is to provide a list of data sets to generate PROC REPORT source code for. The structure data set created by PROC CONTENTS will have one observation for each variable in each data set. PROC SORT with the NODUPKEY option, using MEMNAME (data set name) as the by variable, is used to create a data set with one observation per data set in the specified library.

4 The next DATA step uses the SYMPUT function to store the data set names in a pseudo array of macro variables. This allows a %DO loop to be used to call the source code generating macro for each of the data sets. CONCLUSION The methods presented in this paper illustrate how PROC CONTENTS and the SAS macro language can be used to increase programming efficiency by creating data-driven programs or by generating SAS source code. ACKNOWLEDGMENTS SAS is a registered trademark or trademark of SAS Institute, Inc. in the USA and other countries. Indicates USA registration. CONTACTING THE AUTHOR Robert Graebner Quintiles, Inc. P.O. Box 9708 Kansas City, MO Web Site: bob.graebner@quintiles.com graetech@grapevine.net Quintiles.com

5

6 M W S U G Data Management Jazz Up Your SAS Skills in

7

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

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

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

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

ABSTRACT INTRODUCTION THE GENERAL FORM AND SIMPLE CODE

ABSTRACT INTRODUCTION THE GENERAL FORM AND SIMPLE CODE Paper SA06 Painless Extraction: Options and Macros with PROC PRESENV Keith Fredlund, MS (candidate) Grand Valley State University, Allendale, Michigan; Thinzar Wai, MS (candidate) Grand Valley State University,

More information

SAS Macro Dynamics - From Simple Basics to Powerful Invocations Rick Andrews, Office of the Actuary, CMS, Baltimore, MD

SAS Macro Dynamics - From Simple Basics to Powerful Invocations Rick Andrews, Office of the Actuary, CMS, Baltimore, MD Paper BB-7 SAS Macro Dynamics - From Simple Basics to Powerful Invocations Rick Andrews, Office of the Actuary, CMS, Baltimore, MD ABSTRACT The SAS Macro Facility offers a mechanism for expanding and customizing

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

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

Using MACRO and SAS/GRAPH to Efficiently Assess Distributions. Paul Walker, Capital One

Using MACRO and SAS/GRAPH to Efficiently Assess Distributions. Paul Walker, Capital One Using MACRO and SAS/GRAPH to Efficiently Assess Distributions Paul Walker, Capital One INTRODUCTION A common task in data analysis is assessing the distribution of variables by means of univariate statistics,

More information

SAS Macro Dynamics: from Simple Basics to Powerful Invocations Rick Andrews, Office of Research, Development, and Information, Baltimore, MD

SAS Macro Dynamics: from Simple Basics to Powerful Invocations Rick Andrews, Office of Research, Development, and Information, Baltimore, MD ABSTRACT CODERS CORNER SAS Macro Dynamics: from Simple Basics to Powerful Invocations Rick Andrews, Office of Research, Development, and Information, Baltimore, MD The SAS Macro Facility offers a mechanism

More information

Going Under the Hood: How Does the Macro Processor Really Work?

Going Under the Hood: How Does the Macro Processor Really Work? Going Under the Hood: How Does the Really Work? ABSTRACT Lisa Lyons, PPD, Inc Hamilton, NJ Did you ever wonder what really goes on behind the scenes of the macro processor, or how it works with other parts

More information

SAS Macro Technique for Embedding and Using Metadata in Web Pages. DataCeutics, Inc., Pottstown, PA

SAS Macro Technique for Embedding and Using Metadata in Web Pages. DataCeutics, Inc., Pottstown, PA Paper AD11 SAS Macro Technique for Embedding and Using Metadata in Web Pages Paul Gilbert, Troy A. Ruth, Gregory T. Weber DataCeutics, Inc., Pottstown, PA ABSTRACT This paper will present a technique to

More information

An Efficient Method to Create Titles for Multiple Clinical Reports Using Proc Format within A Do Loop Youying Yu, PharmaNet/i3, West Chester, Ohio

An Efficient Method to Create Titles for Multiple Clinical Reports Using Proc Format within A Do Loop Youying Yu, PharmaNet/i3, West Chester, Ohio PharmaSUG 2012 - Paper CC12 An Efficient Method to Create Titles for Multiple Clinical Reports Using Proc Format within A Do Loop Youying Yu, PharmaNet/i3, West Chester, Ohio ABSTRACT Do you know how to

More information

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

Open Problem for SUAVe User Group Meeting, November 26, 2013 (UVic) 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

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

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

Preserving your SAS Environment in a Non-Persistent World. A Detailed Guide to PROC PRESENV. Steven Gross, Wells Fargo, Irving, TX

Preserving your SAS Environment in a Non-Persistent World. A Detailed Guide to PROC PRESENV. Steven Gross, Wells Fargo, Irving, TX Preserving your SAS Environment in a Non-Persistent World A Detailed Guide to PROC PRESENV Steven Gross, Wells Fargo, Irving, TX ABSTRACT For Enterprise Guide users, one of the challenges often faced is

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

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

Creating Macro Calls using Proc Freq

Creating Macro Calls using Proc Freq Creating Macro Calls using Proc Freq, Educational Testing Service, Princeton, NJ ABSTRACT Imagine you were asked to get a series of statistics/tables for each country in the world. You have the data, but

More information

Simplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA

Simplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA PharmaSUG 2017 BB07 Simplifying Your %DO Loop with CALL EXECUTE Arthur Li, City of Hope National Medical Center, Duarte, CA ABSTRACT One often uses an iterative %DO loop to execute a section of a macro

More information

PDF Multi-Level Bookmarks via SAS

PDF Multi-Level Bookmarks via SAS Paper TS04 PDF Multi-Level Bookmarks via SAS Steve Griffiths, GlaxoSmithKline, Stockley Park, UK ABSTRACT Within the GlaxoSmithKline Oncology team we recently experienced an issue within our patient profile

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

CC13 An Automatic Process to Compare Files. Simon Lin, Merck & Co., Inc., Rahway, NJ Huei-Ling Chen, Merck & Co., Inc., Rahway, NJ

CC13 An Automatic Process to Compare Files. Simon Lin, Merck & Co., Inc., Rahway, NJ Huei-Ling Chen, Merck & Co., Inc., Rahway, NJ CC13 An Automatic Process to Compare Files Simon Lin, Merck & Co., Inc., Rahway, NJ Huei-Ling Chen, Merck & Co., Inc., Rahway, NJ ABSTRACT Comparing different versions of output files is often performed

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

... ) city (city, cntyid, area, pop,.. )

... ) city (city, cntyid, area, pop,.. ) PaperP829 PROC SQl - Is it a Required Tool for Good SAS Programming? Ian Whitlock, Westat Abstract No one SAS tool can be the answer to all problems. However, it should be hard to consider a SAS programmer

More information

PharmaSUG Paper PO12

PharmaSUG Paper PO12 PharmaSUG 2015 - Paper PO12 ABSTRACT Utilizing SAS for Cross-Report Verification in a Clinical Trials Setting Daniel Szydlo, Fred Hutchinson Cancer Research Center, Seattle, WA Iraj Mohebalian, Fred Hutchinson

More information

Unlock SAS Code Automation with the Power of Macros

Unlock SAS Code Automation with the Power of Macros SESUG 2015 ABSTRACT Paper AD-87 Unlock SAS Code Automation with the Power of Macros William Gui Zupko II, Federal Law Enforcement Training Centers SAS code, like any computer programming code, seems to

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

To conceptualize the process, the table below shows the highly correlated covariates in descending order of their R statistic.

To conceptualize the process, the table below shows the highly correlated covariates in descending order of their R statistic. Automating the process of choosing among highly correlated covariates for multivariable logistic regression Michael C. Doherty, i3drugsafety, Waltham, MA ABSTRACT In observational studies, there can be

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

Coders' Corner. Paper Scrolling & Downloading Web Results. Ming C. Lee, Trilogy Consulting, Denver, CO. Abstract.

Coders' Corner. Paper Scrolling & Downloading Web Results. Ming C. Lee, Trilogy Consulting, Denver, CO. Abstract. Paper 71-25 Scrolling & Downloading Web Results Ming C. Lee, Trilogy Consulting, Denver, CO Abstract Since the inception of the INTERNET and Web Browsers, the need for speedy information to make split

More information

Cleaning Duplicate Observations on a Chessboard of Missing Values Mayrita Vitvitska, ClinOps, LLC, San Francisco, CA

Cleaning Duplicate Observations on a Chessboard of Missing Values Mayrita Vitvitska, ClinOps, LLC, San Francisco, CA Cleaning Duplicate Observations on a Chessboard of Missing Values Mayrita Vitvitska, ClinOps, LLC, San Francisco, CA ABSTRACT Removing duplicate observations from a data set is not as easy as it might

More information

Paper A Simplified and Efficient Way to Map Variable Attributes of a Clinical Data Warehouse

Paper A Simplified and Efficient Way to Map Variable Attributes of a Clinical Data Warehouse Paper 117-28 A Simplified and Efficient Way to Map Variable Attributes of a Clinical Data Warehouse Yanyun Shen, Genentech, Inc., South San Francisco ABSTRACT In the pharmaceutical industry, pooling a

More information

Program Validation: Logging the Log

Program Validation: Logging the Log Program Validation: Logging the Log Adel Fahmy, Symbiance Inc., Princeton, NJ ABSTRACT Program Validation includes checking both program Log and Logic. The program Log should be clear of any system Error/Warning

More information

Checking for Duplicates Wendi L. Wright

Checking for Duplicates Wendi L. Wright Checking for Duplicates Wendi L. Wright ABSTRACT This introductory level paper demonstrates a quick way to find duplicates in a dataset (with both simple and complex keys). It discusses what to do when

More information

SAS Macros for Grouping Count and Its Application to Enhance Your Reports

SAS Macros for Grouping Count and Its Application to Enhance Your Reports SAS Macros for Grouping Count and Its Application to Enhance Your Reports Shi-Tao Yeh, EDP Contract Services, Bala Cynwyd, PA ABSTRACT This paper provides two SAS macros, one for one grouping variable,

More information

Run your reports through that last loop to standardize the presentation attributes

Run your reports through that last loop to standardize the presentation attributes PharmaSUG2011 - Paper TT14 Run your reports through that last loop to standardize the presentation attributes Niraj J. Pandya, Element Technologies Inc., NJ ABSTRACT Post Processing of the report could

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

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

Keeping Track of Database Changes During Database Lock

Keeping Track of Database Changes During Database Lock Paper CC10 Keeping Track of Database Changes During Database Lock Sanjiv Ramalingam, Biogen Inc., Cambridge, USA ABSTRACT Higher frequency of data transfers combined with greater likelihood of changes

More information

A SAS Macro Utility to Modify and Validate RTF Outputs for Regional Analyses Jagan Mohan Achi, PPD, Austin, TX Joshua N. Winters, PPD, Rochester, NY

A SAS Macro Utility to Modify and Validate RTF Outputs for Regional Analyses Jagan Mohan Achi, PPD, Austin, TX Joshua N. Winters, PPD, Rochester, NY PharmaSUG 2014 - Paper BB14 A SAS Macro Utility to Modify and Validate RTF Outputs for Regional Analyses Jagan Mohan Achi, PPD, Austin, TX Joshua N. Winters, PPD, Rochester, NY ABSTRACT Clinical Study

More information

Copy That! Using SAS to Create Directories and Duplicate Files

Copy That! Using SAS to Create Directories and Duplicate Files Copy That! Using SAS to Create Directories and Duplicate Files, SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and

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

Paper An Automated Reporting Macro to Create Cell Index An Enhanced Revisit. Shi-Tao Yeh, GlaxoSmithKline, King of Prussia, PA

Paper An Automated Reporting Macro to Create Cell Index An Enhanced Revisit. Shi-Tao Yeh, GlaxoSmithKline, King of Prussia, PA ABSTRACT Paper 236-28 An Automated Reporting Macro to Create Cell Index An Enhanced Revisit When generating tables from SAS PROC TABULATE or PROC REPORT to summarize data, sometimes it is necessary to

More information

STEP 1 - /*******************************/ /* Manipulate the data files */ /*******************************/ <<SAS DATA statements>>

STEP 1 - /*******************************/ /* Manipulate the data files */ /*******************************/ <<SAS DATA statements>> Generalized Report Programming Techniques Using Data-Driven SAS Code Kathy Hardis Fraeman, A.K. Analytic Programming, L.L.C., Olney, MD Karen G. Malley, Malley Research Programming, Inc., Rockville, MD

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

ABSTRACT INTRODUCTION TRICK 1: CHOOSE THE BEST METHOD TO CREATE MACRO VARIABLES

ABSTRACT INTRODUCTION TRICK 1: CHOOSE THE BEST METHOD TO CREATE MACRO VARIABLES An Efficient Method to Create a Large and Comprehensive Codebook Wen Song, ICF International, Calverton, MD Kamya Khanna, ICF International, Calverton, MD Baibai Chen, ICF International, Calverton, MD

More information

&&&, ;;, and Other Hieroglyphics Advanced Macro Topics Chris Yindra, C. Y. Training Associates

&&&, ;;, and Other Hieroglyphics Advanced Macro Topics Chris Yindra, C. Y. Training Associates &&&, ;;, and Other Hieroglyphics Advanced Macro Topics Chris Yindra, C. Y. Training Associates INTRODUCTION SAS macros are powerful tools that can create reusable code modules to do a variety of programming

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

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

Macro Method to use Google Maps and SAS to Geocode a Location by Name or Address

Macro Method to use Google Maps and SAS to Geocode a Location by Name or Address Paper 2684-2018 Macro Method to use Google Maps and SAS to Geocode a Location by Name or Address Laurie Smith, Cincinnati Children s Hospital Medical Center, Cincinnati, Ohio ABSTRACT Google Maps is a

More information

SAS Programming Techniques for Manipulating Metadata on the Database Level Chris Speck, PAREXEL International, Durham, NC

SAS Programming Techniques for Manipulating Metadata on the Database Level Chris Speck, PAREXEL International, Durham, NC PharmaSUG2010 - Paper TT06 SAS Programming Techniques for Manipulating Metadata on the Database Level Chris Speck, PAREXEL International, Durham, NC ABSTRACT One great leap that beginning and intermediate

More information

Host Systems. SEsua '95 Proceedings. SAS to.dbfby Way ofmvs

Host Systems. SEsua '95 Proceedings. SAS to.dbfby Way ofmvs SAS to.dbfby Way ofmvs Robert F. Davis Micro Craft Technology/AEDC Operations Arnold Engineering Development Center Arnold Air Force Base, TN 37389 ABSTRACT Database applications such as dbaseivi5 and

More information

Hugh Geary, Neoprobe Corporation, Dublin, Ohio

Hugh Geary, Neoprobe Corporation, Dublin, Ohio A Macro Tool for Quickly Producing a Handy Documented Listing of SAS Data Sets for Use as a Reference While Writing Programs to Analyze the Same Hugh Geary, Neoprobe Corporation, Dublin, Ohio Abstract

More information

Quality Control of Clinical Data Listings with Proc Compare

Quality Control of Clinical Data Listings with Proc Compare ABSTRACT Quality Control of Clinical Data Listings with Proc Compare Robert Bikwemu, Pharmapace, Inc., San Diego, CA Nicole Wallstedt, Pharmapace, Inc., San Diego, CA Checking clinical data listings with

More information

Macros from Beginning to Mend A Simple and Practical Approach to the SAS Macro Facility

Macros from Beginning to Mend A Simple and Practical Approach to the SAS Macro Facility Macros from Beginning to Mend A Simple and Practical Approach to the SAS Macro Facility Michael G. Sadof, MGS Associates, Inc., Bethesda, MD. ABSTRACT The macro facility is an important feature of the

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

Automating Comparison of Multiple Datasets Sandeep Kottam, Remx IT, King of Prussia, PA

Automating Comparison of Multiple Datasets Sandeep Kottam, Remx IT, King of Prussia, PA Automating Comparison of Multiple Datasets Sandeep Kottam, Remx IT, King of Prussia, PA ABSTRACT: Have you ever been asked to compare new datasets to old datasets while transfers of data occur several

More information

A Few Quick and Efficient Ways to Compare Data

A Few Quick and Efficient Ways to Compare Data A Few Quick and Efficient Ways to Compare Data Abraham Pulavarti, ICON Clinical Research, North Wales, PA ABSTRACT In the fast paced environment of a clinical research organization, a SAS programmer has

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

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

22S:172. Duplicates. may need to check for either duplicate ID codes or duplicate observations duplicate observations should just be eliminated

22S:172. Duplicates. may need to check for either duplicate ID codes or duplicate observations duplicate observations should just be eliminated 22S:172 1 2 Duplicates Data Cleaning involving duplicate IDs and duplicate records may need to check for either duplicate ID codes or duplicate observations duplicate observations should just be eliminated

More information

PharmaSUG 2013 CC26 Automating the Labeling of X- Axis Sanjiv Ramalingam, Vertex Pharmaceuticals, Inc., Cambridge, MA

PharmaSUG 2013 CC26 Automating the Labeling of X- Axis Sanjiv Ramalingam, Vertex Pharmaceuticals, Inc., Cambridge, MA PharmaSUG 2013 CC26 Automating the Labeling of X- Axis Sanjiv Ramalingam, Vertex Pharmaceuticals, Inc., Cambridge, MA ABSTRACT Labeling of the X-axis usually involves a tedious axis statement specifying

More information

One Project, Two Teams: The Unblind Leading the Blind

One Project, Two Teams: The Unblind Leading the Blind ABSTRACT PharmaSUG 2017 - Paper BB01 One Project, Two Teams: The Unblind Leading the Blind Kristen Reece Harrington, Rho, Inc. In the pharmaceutical world, there are instances where multiple independent

More information

Get Started Writing SAS Macros Luisa Hartman, Jane Liao, Merck Sharp & Dohme Corp.

Get Started Writing SAS Macros Luisa Hartman, Jane Liao, Merck Sharp & Dohme Corp. Get Started Writing SAS Macros Luisa Hartman, Jane Liao, Merck Sharp & Dohme Corp. ABSTRACT The SAS Macro Facility is a tool which lends flexibility to your SAS code and promotes easier maintenance. It

More information

Tales from the Help Desk 6: Solutions to Common SAS Tasks

Tales from the Help Desk 6: Solutions to Common SAS Tasks SESUG 2015 ABSTRACT Paper BB-72 Tales from the Help Desk 6: Solutions to Common SAS Tasks Bruce Gilsen, Federal Reserve Board, Washington, DC In 30 years as a SAS consultant at the Federal Reserve Board,

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

A Practical and Efficient Approach in Generating AE (Adverse Events) Tables within a Clinical Study Environment

A Practical and Efficient Approach in Generating AE (Adverse Events) Tables within a Clinical Study Environment A Practical and Efficient Approach in Generating AE (Adverse Events) Tables within a Clinical Study Environment Abstract Jiannan Hu Vertex Pharmaceuticals, Inc. When a clinical trial is at the stage of

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

The REPORT Procedure CHAPTER 32

The REPORT Procedure CHAPTER 32 859 CHAPTER 32 The REPORT Procedure Overview 861 Types of Reports 861 A Sampling of Reports 861 Concepts 866 Laying Out a Report 866 Usage of Variables in a Report 867 Display Variables 867 Order Variables

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

EXAMPLES OF DATA LISTINGS AND CLINICAL SUMMARY TABLES USING PROC REPORT'S BATCH LANGUAGE

EXAMPLES OF DATA LISTINGS AND CLINICAL SUMMARY TABLES USING PROC REPORT'S BATCH LANGUAGE EXAMPLES OF DATA LISTINGS AND CLINICAL SUMMARY TABLES USING PROC REPORT'S BATCH LANGUAGE Rob Hoffman Hoffmann-La Roche, Inc. Abstract PROC REPORT Is a powerful report writing tool which can easily create

More information

Matt Downs and Heidi Christ-Schmidt Statistics Collaborative, Inc., Washington, D.C.

Matt Downs and Heidi Christ-Schmidt Statistics Collaborative, Inc., Washington, D.C. Paper 82-25 Dynamic data set selection and project management using SAS 6.12 and the Windows NT 4.0 file system Matt Downs and Heidi Christ-Schmidt Statistics Collaborative, Inc., Washington, D.C. ABSTRACT

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

Internet/Intranet, the Web & SAS

Internet/Intranet, the Web & SAS Dynamic Behavior from Static Web Applications Ted Durie, SAS, Overland Park, KS ABSTRACT Many Web applications, because of the infinite query combinations possible, require dynamic Web solutions. This

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

PROC REPORT AN INTRODUCTION

PROC REPORT AN INTRODUCTION Table Generation Using the PROC REPORT Feature Edward R. Smith, Senior Scientific Programmer Covance Periapproval Services Inc, Radnor, PA ABSTRACT The PROC REPORT procedure is a powerful report generation

More information

A Macro to Keep Titles and Footnotes in One Place

A Macro to Keep Titles and Footnotes in One Place CC25 ABSTRACT A Macro to Keep Titles and Footnotes in One Place John Morrill, Quintiles, Inc., Kansas City, MO A large project with titles and footnotes in each separate program can be cumbersome to maintain.

More information

The DATA Statement: Efficiency Techniques

The DATA Statement: Efficiency Techniques The DATA Statement: Efficiency Techniques S. David Riba, JADE Tech, Inc., Clearwater, FL ABSTRACT One of those SAS statements that everyone learns in the first day of class, the DATA statement rarely gets

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

SAS Data Integration Studio Take Control with Conditional & Looping Transformations

SAS Data Integration Studio Take Control with Conditional & Looping Transformations Paper 1179-2017 SAS Data Integration Studio Take Control with Conditional & Looping Transformations Harry Droogendyk, Stratia Consulting Inc. ABSTRACT SAS Data Integration Studio jobs are not always linear.

More information

How to Incorporate Old SAS Data into a New DATA Step, or What is S-M-U?

How to Incorporate Old SAS Data into a New DATA Step, or What is S-M-U? Paper 54-25 How to Incorporate Old SAS Data into a New DATA Step, or What is S-M-U? Andrew T. Kuligowski Nielsen Media Research Abstract / Introduction S-M-U. Some people will see these three letters and

More information

USING DATA TO SET MACRO PARAMETERS

USING DATA TO SET MACRO PARAMETERS USING DATA TO SET MACRO PARAMETERS UPDATE A PREVIOUS EXAMPLE %macro report(regs=); %let r=1; %let region=%scan(&regs,&r); %do %until(&region eq ); options nodate pageno=1; ods pdf file="&region..pdf";

More information

A Quick and Gentle Introduction to PROC SQL

A Quick and Gentle Introduction to PROC SQL ABSTRACT Paper B2B 9 A Quick and Gentle Introduction to PROC SQL Shane Rosanbalm, Rho, Inc. Sam Gillett, Rho, Inc. If you are afraid of SQL, it is most likely because you haven t been properly introduced.

More information

Create a Format from a SAS Data Set Ruth Marisol Rivera, i3 Statprobe, Mexico City, Mexico

Create a Format from a SAS Data Set Ruth Marisol Rivera, i3 Statprobe, Mexico City, Mexico PharmaSUG 2011 - Paper TT02 Create a Format from a SAS Data Set Ruth Marisol Rivera, i3 Statprobe, Mexico City, Mexico ABSTRACT Many times we have to apply formats and it could be hard to create them specially

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

Best Practices for Using the SAS Scalable Performance Data Server in a SAS Grid environment

Best Practices for Using the SAS Scalable Performance Data Server in a SAS Grid environment Best Practices for Using the SAS Scalable Performance Data Server in a SAS Grid environment Introduction This document describes how to set up the SAS Scalable Performance Data Server, SPD Server, to run

More information

GET A GRIP ON MACROS IN JUST 50 MINUTES! Arthur Li, City of Hope Comprehensive Cancer Center, Duarte, CA

GET A GRIP ON MACROS IN JUST 50 MINUTES! Arthur Li, City of Hope Comprehensive Cancer Center, Duarte, CA GET A GRIP ON MACROS IN JUST 50 MINUTES! Arthur Li, City of Hope Comprehensive Cancer Center, Duarte, CA ABSTRACT The SAS macro facility, which includes macro variables and macro programs, is the most

More information

Symbol Table Generator (New and Improved) Jim Johnson, JKL Consulting, North Wales, PA

Symbol Table Generator (New and Improved) Jim Johnson, JKL Consulting, North Wales, PA PharmaSUG2011 - Paper AD19 Symbol Table Generator (New and Improved) Jim Johnson, JKL Consulting, North Wales, PA ABSTRACT In Seattle at the PharmaSUG 2000 meeting the Symbol Table Generator was first

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

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

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

A Cross-reference for SAS Data Libraries

A Cross-reference for SAS Data Libraries A Cross-reference for SAS Data Libraries John R. Gerlach, Maxim Group, Plymouth Meeting, PA Cindy Garra, IMS HEALTH; Plymouth Meeting, PA Abstract SAS data libraries often resemble a relational model when

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

SAS Online Training: Course contents: Agenda:

SAS Online Training: Course contents: Agenda: SAS Online Training: Course contents: Agenda: (1) Base SAS (6) Clinical SAS Online Training with Real time Projects (2) Advance SAS (7) Financial SAS Training Real time Projects (3) SQL (8) CV preparation

More information

Justina M. Flavin, Synteract, Inc.

Justina M. Flavin, Synteract, Inc. Using PROC REPORT to Summarize Clinical Safety Data Justina M. Flavin, Synteract, Inc. ABSTRACT By using the summary and display features available In PROC REPORT, the amount of code needed to generate

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

APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software. Each of these steps can be executed independently.

APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software. Each of these steps can be executed independently. 255 APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software Introduction 255 Generating a QMF Export Procedure 255 Exporting Queries from QMF 257 Importing QMF Queries into Query and Reporting 257 Alternate

More information

3N Validation to Validate PROC COMPARE Output

3N Validation to Validate PROC COMPARE Output ABSTRACT Paper 7100-2016 3N Validation to Validate PROC COMPARE Output Amarnath Vijayarangan, Emmes Services Pvt Ltd, India In the clinical research world, data accuracy plays a significant role in delivering

More information