The Power of CALL SYMPUT DATA Step Interface by Examples Yunchao (Susan) Tian, Social & Scientific Systems, Inc., Silver Spring, MD

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "The Power of CALL SYMPUT DATA Step Interface by Examples Yunchao (Susan) Tian, Social & Scientific Systems, Inc., Silver Spring, MD"

Transcription

1 Paper The Power of CALL SYMPUT DATA Step Interface by Examples Yunchao (Susan) Tian, Social & Scientific Systems, Inc., Silver Spring, MD ABSTRACT AND INTRODUCTION CALL SYMPUT is a SAS language routine that assigns a value produced in a DATA step to a macro variable. It is one of the DATA step interface tools that provides a dynamic link for communication between the SAS language and the macro facility. This paper will discuss the uses of the SYMPUT routine through real world examples. Both beginning and experienced macro programmers will benefit from the examples by recognizing the wide application and increasing the understanding of this DATA step interface tool. Besides CALL SYMPUT, other features of the macro facility that are demonstrated include the construction of macro variable names through concatenation, the double ampersand, the %DO loop, the %GOTO statement and statement label, and the implicit %EVAL function. EXAMPLE : CREATE A SERIES OF VARIABLE NAMES FROM ANOTHER VARIABLE'S VALUES When performing logistic regression, we often need to create dummy variables based on all possible values of another variable. For instance, we want to create dummy variables for the variable CON which has over 400 different integer values from to 506. Basically we need to do the following: IF CON = THEN CON = ; ELSE CON = 0; IF CON = 2 THEN CON2 = ; ELSE CON2 = 0; IF CON = 506 THEN CON506 = ; ELSE CON506 = 0; It is not practical to write this many statements. Our goal is to use the SYMPUT routine to obtain this code automatically. In the following program, a sample data set TESTDATA with 2 observations and variable is first created in step (). Then in step (2), a data set UNIQUE is created containing 8 unique CON values. In step (3), the SYMPUT routine assigns the largest value of CON to the macro variable N. CALL SYMPUT is executed once when the DATA step reaches the end of the data set. In step (4), the macro variable N s value is retrieved and CALL SYMPUT is executed 506 times to create 506 macro variables M-M506 with the initial value 0. The PUT function is used to eliminate a note that numeric values have been converted to character values. The LEFT function is used to left-align the value of the index variable, I, to avoid creating macro variable names with blanks. In step (5), CALL SYMPUT is executed 8 times and the values of the 8 macro variables created in step (4) are updated with the values of the corresponding CON. The 498 macro variables without the corresponding CON values will remain the initial value 0. Step (6) is a macro that generates all dummy variables for all possible values of CON. By using the %GOTO statement and statement label, the dummy variables without the corresponding CON values will not be created. Note that the double ampersand is necessary to cause the macro processor to scan the text twice first to generate the reference and then to resolve it. Step () invokes the macro GETCON to create the dummy variables for every observation in the data set TESTDATA. The last step prints the output data set with dummy variables shown in Table. /* () Create a sample data set TESTDATA. */ DATA TESTDATA; INPUT CON; CARDS; ;

2 /* (2) Get the unique values of CON. */ PROC SORT DATA=TESTDATA OUT=UNIQUE NODUPKEY; BY CON; /* (3) Assign the largest value of CON to the macro variable N. */ SET UNIQUE END=LAST; IF LAST THEN CALL SYMPUT('N', PUT(CON, 3.)); /* (4) Assign the initial value 0 to all macro variables. */ DO I = TO &N; CALL SYMPUT('M' LEFT(PUT(I, 3.)), '0'); END; /* (5) Assign the value of CON to the corresponding macro variable. */ SET UNIQUE; CALL SYMPUT('M' LEFT(PUT(CON, 3.)), PUT(CON, 3.)); /* (6) Macro to generate dummy variables. */ %MACRO GETCON; %IF &&M&I = 0 %THEN %GOTO OUT; IF CON = &&M&I THEN CON&I = ; ELSE CON&I = 0; %OUT: %MEND GETCON; /* () Create dummy variables. */ DATA TESTDATA; SET TESTDATA; %GETCON /* (8) Print the result. */ PROC PRINT DATA=TESTDATA; TITLE 'Table. List of CON with dummy variables'; Table. List of CON with dummy variables Obs CON CON CON CON34 CON43 CON5 CON5 CON48 CON

3 EXAMPLE 2: GENERATE LABELS FOR A SERIES OF VARIABLES USING EXISTING FORMATS In this example, the problem is to label the variables FLAG-FLAG200 using the existing formats in format library. In the following program, a sample data set FLAGS with one observation and six variables is created. The task is to label each variable with the corresponding format, i.e., label FLAG with Red, and so on. The CALL SYMPUT statement in DATA _NULL_ step assigns the format FMTFLAG as the values to a set of macro variables FMT- FMT6. Then in the macro LABELS, the variables FLAG-FLAG6 are associated with the labels using the values of the macro variables FMT-FMT6. Invoking the macro LABELS in the LABEL statement in the subsequent DATA step generates labels for all variables FLAG-FLAG6. The PROC CONTENTS lists all variables with the assigned labels shown in Table 2. DATA FLAGS; FLAG = ; FLAG2 = ; FLAG3 = 0; FLAG4 = ; FLAG5 = 0; FLAG6 = ; PROC FORMAT; VALUE FMTFLAG ='Red' 2='Purple' 3='Blue' 4='Yellow' 5='Orange' 6='Green'; %LET N = 6; DO I = TO &N; CALL SYMPUT('FMT' LEFT(PUT(I, 3.)), PUT(I, FMTFLAG.)); END; %MACRO LABELS; FLAG&I = "&&FMT&I" %MEND LABELS; DATA FLAGS; SET FLAGS; LABEL %LABELS; PROC CONTENTS DATA=FLAGS; TITLE 'Table 2. Contents of SAS data set FLAGS showing variable labels'; Table 2. Contents of SAS data set FLAGS showing variable labels # Variable Type Len Pos Label FLAG Num 8 0 Red 2 FLAG2 Num 8 8 Purple 3 FLAG3 Num 8 6 Blue 4 FLAG4 Num 8 24 Yellow 5 FLAG5 Num 8 32 Orange 6 FLAG6 Num 8 40 Green 3

4 EXAMPLE 3: SYMPUT ROUTINE WITH BYTE FUNCTION We can write the following macro to read a numbered series of raw data files with the same layout to create a series of SAS data sets with the same names as the raw data files. %MACRO READ(N); DATA CTY_&I; INFILE "C:\SUGI29\CTY_&I"; INPUT ID F96 F9 F98; %MEND READ; In each iteration of the %DO loop, one DATA step is generated. Invoking this macro with the parameter 3 generates three DATA steps that create three SAS data sets, CTY_, CTY_2, and CTY_3. Now let s suppose we want all the SAS data sets created above to be saved in an alphabetically ordered series of names. In another word, the SAS data set created from the raw data file CTY_ will be called CTY_A, the SAS data set from CTY_2 will be called CTY_B, and so on. We can accomplish this by using the following statement: CALL SYMPUT('L', BYTE(&I+64)); The BYTE function automatically invokes the %EVAL function and returns a character value represented by the integer value returned by the %EVAL function. For example, the BYTE function returns the character A when the value of the index variable, I, is since A is the 65 th character on the ASCII system. Then the SYMPUT routine assigns the character value returned by the BYTE function to the macro variable L. If we apply this statement to the DATA steps above and retrieve the macro variable L s value in subsequent DATA steps, we can create a series of SAS data sets with alphabetically ordered names. So invoking the following macro with the parameter 3 creates three SAS data sets named CTY_A, CTY_B, and CTY_C. %MACRO READ(N); DATA CTY_&I; INFILE "C:\SUGI29\CTY_&I"; INPUT ID F96 F9 F98; CALL SYMPUT('L', BYTE(&I+64)); DATA CTY_&L; SET CTY_&I; %MEND READ; CONCLUSION CALL SYMPUT provides a powerful vehicle to transfer information between program steps. The examples presented in this paper can be easily modified to fit the needs of different users. There are many opportunities to apply CALL SYMPUT in our day to day programming. A few important facts need to be remembered in using CALL SYMPUT. The SYMPUT routine assigns the value of the macro variable during DATA step execution, but the macro variable references resolve during the compilation of a step or global statement. So you can t retrieve the macro variable s value in the same DATA step in which the SYMPUT routine assigns that value. The SYMPUT routine must be used as part of the CALL statement. Since CALL SYMPUT is a SAS language routine, character string arguments need to be enclosed in single or double quotation marks. In most cases, a macro variable created by the SYMPUT routine is global. ACKNOWLEDGMENTS I would like to thank my client Dr. Chunliu Zhan for providing me the challenges over the years, which contributed a lot to this paper. I also want to thank my colleagues Dr. Raymond Hu and Deborah Johnson for their helpful discussions. 4

5 CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Yunchao (Susan) Tian Social & Scientific Systems, Inc. 85 Georgia Avenue, 2 th Floor Silver Spring, MD 2090 Work Phone: (30) Fax: (30) SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies. 5

More Tales from the Help Desk: Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board

More Tales from the Help Desk: Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board More Tales from the Help Desk: Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board INTRODUCTION In 20 years as a SAS consultant at the Federal Reserve Board, I have seen SAS users make

More information

Writing cleaner and more powerful SAS code using macros. Patrick Breheny

Writing cleaner and more powerful SAS code using macros. Patrick Breheny Writing cleaner and more powerful SAS code using macros Patrick Breheny Why Use Macros? Macros automatically generate SAS code Macros allow you to make more dynamic, complex, and generalizable SAS programs

More information

The SAS Data step/macro Interface

The SAS Data step/macro Interface Paper TS09 The SAS Data step/macro Interface Lawrence Heaton-Wright, Quintiles, Bracknell, Berkshire, UK ABSTRACT The SAS macro facility is an extremely useful part of the SAS System. However, macro variables

More information

Better Safe than Sorry: A SAS Macro to Selectively Back Up Files

Better Safe than Sorry: A SAS Macro to Selectively Back Up Files Better Safe than Sorry: A SAS Macro to Selectively Back Up Files Jia Wang, Data and Analytic Solutions, Inc., Fairfax, VA Zhengyi Fang, Social & Scientific Systems, Inc., Silver Spring, MD ABSTRACT SAS

More information

Nine Steps to Get Started using SAS Macros

Nine Steps to Get Started using SAS Macros Paper 56-28 Nine Steps to Get Started using SAS Macros Jane Stroupe, SAS Institute, Chicago, IL ABSTRACT Have you ever heard your coworkers rave about macros? If so, you've probably wondered what all the

More information

Call Execute: Let Your Program Run Your Macro

Call Execute: Let Your Program Run Your Macro Paper CC06 Call Execute: Let Your Program Run Your Macro Artur Usov, OCS Consulting BV, s-hertogenbosch, Netherlands ABSTRACT The SAS Macro language is an extremely flexible tool which facilitates SAS

More information

Storing and Using a List of Values in a Macro Variable

Storing and Using a List of Values in a Macro Variable 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 unusual to need

More information

Automatically Converting Character Variables That Store Numbers to Numeric Variables

Automatically Converting Character Variables That Store Numbers to Numeric Variables Automatically Converting Character Variables That Store Numbers to Numeric Variables Christopher J. Bost, MDRC, New York, NY ABSTRACT A character variable can store numbers, but many analyses require numeric

More information

Preparing Real World Data in Excel Sheets for Statistical Analysis

Preparing Real World Data in Excel Sheets for Statistical Analysis Paper DM03 Preparing Real World Data in Excel Sheets for Statistical Analysis Volker Harm, Bayer Schering Pharma AG, Berlin, Germany ABSTRACT This paper collects a set of techniques of importing Excel

More information

1) String initialization can be carried out in the following ways, similar to that of an array :

1) String initialization can be carried out in the following ways, similar to that of an array : Strings in C : Overview : String data type is not supported in C Programming. String is essentially a collection of characters to form particular word. String is useful whenever we accept name of the person,

More information

B) Mean Function: This function returns the arithmetic mean (average) and ignores the missing value. E.G: Var=MEAN (var1, var2, var3 varn);

B) Mean Function: This function returns the arithmetic mean (average) and ignores the missing value. E.G: Var=MEAN (var1, var2, var3 varn); SAS-INTERVIEW QUESTIONS 1. What SAS statements would you code to read an external raw data file to a DATA step? Ans: Infile and Input statements are used to read external raw data file to a Data Step.

More information

SAS Macro Programming for Beginners

SAS Macro Programming for Beginners Paper 243-29 SAS Macro Programming for Beginners Susan J. Slaughter, Avocet Solutions, Davis, CA Lora D. Delwiche, Delwiche Consulting, Winters, CA ABSTRACT Macro programming is generally considered an

More information

Nutech Computer Training Institute 1682 E. Gude Dr. #102, Rockville, MD Tel: Website:

Nutech Computer Training Institute 1682 E. Gude Dr. #102, Rockville, MD Tel: Website: Nutech Computer Training Institute 1682 E. Gude Dr. #102, Rockville, MD. 20850 Tel:301-610-9300 Website: www.nutechtraining.com SAS Hands-On Programming Training Outline Total Hours: 96 hrs Package Tuition

More information

Post Processing Macro in Clinical Data Reporting Niraj J. Pandya

Post Processing Macro in Clinical Data Reporting Niraj J. Pandya Post Processing Macro in Clinical Data Reporting Niraj J. Pandya ABSTRACT Post Processing is the last step of generating listings and analysis reports of clinical data reporting in pharmaceutical industry

More information

Labels, Labels, and More Labels Stephanie R. Thompson, Rochester Institute of Technology, Rochester, NY

Labels, Labels, and More Labels Stephanie R. Thompson, Rochester Institute of Technology, Rochester, NY Paper FF-007 Labels, Labels, and More Labels Stephanie R. Thompson, Rochester Institute of Technology, Rochester, NY ABSTRACT SAS datasets include labels as optional variable attributes in the descriptor

More information

Using Pharmacovigilance Reporting System to Generate Ad-hoc Reports

Using Pharmacovigilance Reporting System to Generate Ad-hoc Reports Using Pharmacovigilance Reporting System to Generate Ad-hoc Reports Jeff Cai, Amylin Pharmaceuticals, Inc., San Diego, CA Jay Zhou, Amylin Pharmaceuticals, Inc., San Diego, CA ABSTRACT To supplement Oracle

More information

SAS and UNIX: Techniques for Developing Your Toolbox Joe Novotny, GlaxoSmithKline Pharmaceuticals, Inc., Collegeville, PA

SAS and UNIX: Techniques for Developing Your Toolbox Joe Novotny, GlaxoSmithKline Pharmaceuticals, Inc., Collegeville, PA Paper AA600 SAS and UNIX: Techniques for Developing Your Toolbox Joe Novotny, GlaxoSmithKline Pharmaceuticals, Inc., Collegeville, PA ABSTRACT How many times have you had to write and run short SAS programs

More information

SUGI 29 Coders' Corner

SUGI 29 Coders' Corner Paper 063-29 The Role of Consecutive Ampersands in Macro Variable Resolution and the Mathematical Patterns that Follow Michael J. Molter, Howard Proskin and Associates, Rochester, New York ABSTRACT As

More information

How to Reduce the Disk Space Required by a SAS Data Set

How to Reduce the Disk Space Required by a SAS Data Set How to Reduce the Disk Space Required by a SAS Data Set Selvaratnam Sridharma, U.S. Census Bureau, Washington, DC ABSTRACT SAS datasets can be large and disk space can often be at a premium. In this paper,

More information

So You Want to be SAS Certified Ben Cochran, The Bedford Group, Raleigh, NC

So You Want to be SAS Certified Ben Cochran, The Bedford Group, Raleigh, NC Paper BB-15-2014 So You Want to be SAS Certified Ben Cochran, The Bedford Group, Raleigh, NC ABSTRACT Several years ago, SAS Institute, Inc. started a Certification program to give SAS users a chance to

More information

Line Feeds How to detect them and get rid of them? Kalyani Kothapalli, MDS Pharma Services, Lincoln, NE

Line Feeds How to detect them and get rid of them? Kalyani Kothapalli, MDS Pharma Services, Lincoln, NE Paper CC06 Line Feeds How to detect them and get rid of them? Kalyani Kothapalli, MDS Pharma Services, Lincoln, NE ABSTRACT: In the pharmaceutical industry, it is common to receive data in EXCEL format.

More information

Instant Interactive SAS Log Window Analyzer

Instant Interactive SAS Log Window Analyzer ABSTRACT Paper 10240-2016 Instant Interactive SAS Log Window Analyzer Palanisamy Mohan, ICON Clinical Research India Pvt Ltd Amarnath Vijayarangan, Emmes Services Pvt Ltd, India An interactive SAS environment

More information

SAS Clinical Training

SAS Clinical Training Course Outline for SAS Clinical Training SAS Clinical Training SAS Clinical Introduction History of SAS SAS comes in ERP sector or not? Why? Role of Statistical Analysis in Clinical Research Study and

More information

EXTRACTING DATA FROM PDF FILES

EXTRACTING DATA FROM PDF FILES Paper SER10_05 EXTRACTING DATA FROM PDF FILES Nat Wooding, Dominion Virginia Power, Richmond, Virginia ABSTRACT The Adobe Portable Document File (PDF) format has become a popular means of producing documents

More information

What You re Missing About Missing Values

What You re Missing About Missing Values Paper 1440-2014 What You re Missing About Missing Values Christopher J. Bost, MDRC, New York, NY ABSTRACT Do you know everything you need to know about missing values? Do you know how to assign a missing

More information

Using Macros to Automate SAS Processing Kari Richardson, SAS Institute, Cary, NC Eric Rossland, SAS Institute, Dallas, TX

Using Macros to Automate SAS Processing Kari Richardson, SAS Institute, Cary, NC Eric Rossland, SAS Institute, Dallas, TX Paper 126-29 Using Macros to Automate SAS Processing Kari Richardson, SAS Institute, Cary, NC Eric Rossland, SAS Institute, Dallas, TX ABSTRACT This hands-on workshop shows how to use the SAS Macro Facility

More information

SAS Online Course - Smart Mind Online Training, Hyderabad. SAS Online Training Course Content

SAS Online Course - Smart Mind Online Training, Hyderabad. SAS Online Training Course Content Faculty: Real time and certified SAS Online Training Course Content (Includes theoretical as well as practical sessions) BASICS BEFORE STARTING SAS: DATAWAREHOSING Concepts What is ETL ETL Concepts What

More information

Remove Voided Claims for Insurance Data Qiling Shi

Remove Voided Claims for Insurance Data Qiling Shi Remove Voided Claims for Insurance Data Qiling Shi ABSTRACT The purpose of this study is to remove voided claims for insurance claim data using SAS. Suppose that for these voided claims, we don t have

More information

Search and Replace in SAS Data Sets thru GUI

Search and Replace in SAS Data Sets thru GUI Search and Replace in SAS Data Sets thru GUI Edmond Cheng, Bureau of Labor Statistics, Washington, DC ABSTRACT In managing data with SAS /BASE software, performing a search and replace is not a straight

More information

Automated Data Converting of Character into Numeric Fields

Automated Data Converting of Character into Numeric Fields Paper CC-030 Automated Data Converting of Character into Numeric Fields Mila Chiflikyan, RTI International, Research Triangle Park, NC Nick L Kinsey, RTI International, Research Triangle Park, NC Ruben

More information

The SET Statement and Beyond: Uses and Abuses of the SET Statement. S. David Riba, JADE Tech, Inc., Clearwater, FL

The SET Statement and Beyond: Uses and Abuses of the SET Statement. S. David Riba, JADE Tech, Inc., Clearwater, FL The SET Statement and Beyond: Uses and Abuses of the SET Statement S. David Riba, JADE Tech, Inc., Clearwater, FL ABSTRACT The SET statement is one of the most frequently used statements in the SAS System.

More information

AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike S. Zdeb, New York State Department of Health

AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike S. Zdeb, New York State Department of Health AN INTRODUCTION TO MACRO VARIABLES AND MACRO PROGRAMS Mike S. Zdeb, New York State Department of Health INTRODUCTION There are a number of SAS tools that you may never have to use. Why? The main reason

More information

Emailing Automated Notification of Errors in a Batch SAS Program Julie Kilburn, City of Hope, Duarte, CA Rebecca Ottesen, City of Hope, Duarte, CA

Emailing Automated Notification of Errors in a Batch SAS Program Julie Kilburn, City of Hope, Duarte, CA Rebecca Ottesen, City of Hope, Duarte, CA Emailing Automated Notification of Errors in a Batch SAS Program Julie Kilburn, City of Hope, Duarte, CA Rebecca Ottesen, City of Hope, Duarte, CA ABSTRACT With multiple programmers contributing to a batch

More information

SUGI 29 Tutorials. Paper 253-29 The Input Statement: Where Ronald Cody, Ed.D., Robert Wood Johnson Medical School, Piscataway, NJ

SUGI 29 Tutorials. Paper 253-29 The Input Statement: Where Ronald Cody, Ed.D., Robert Wood Johnson Medical School, Piscataway, NJ Paper 253-29 The Input Statement: Where It's @ Ronald Cody, Ed.D., Robert Wood Johnson Medical School, Piscataway, NJ Introduction One of the most powerful features of SAS software is the ability to read

More information

Applications Development ABSTRACT PROGRAM DESIGN INTRODUCTION SAS FEATURES USED

Applications Development ABSTRACT PROGRAM DESIGN INTRODUCTION SAS FEATURES USED Checking and Tracking SAS Programs Using SAS Software Keith M. Gregg, Ph.D., SCIREX Corporation, Chicago, IL Yefim Gershteyn, Ph.D., SCIREX Corporation, Chicago, IL ABSTRACT Various checks on consistency

More information

A Method for Cleaning Clinical Trial Analysis Data Sets

A Method for Cleaning Clinical Trial Analysis Data Sets A Method for Cleaning Clinical Trial Analysis Data Sets Carol R. Vaughn, Bridgewater Crossings, NJ ABSTRACT This paper presents a method for using SAS software to search SAS programs in selected directories

More information

Subsetting Observations from Large SAS Data Sets

Subsetting Observations from Large SAS Data Sets Subsetting Observations from Large SAS Data Sets Christopher J. Bost, MDRC, New York, NY ABSTRACT This paper reviews four techniques to subset observations from large SAS data sets: MERGE, PROC SQL, user-defined

More information

Building a Web Based EIS for Data Analysis Ed Confer, KGC Programming Solutions, Potomac Falls, VA

Building a Web Based EIS for Data Analysis Ed Confer, KGC Programming Solutions, Potomac Falls, VA Building a Web Based EIS for Data Analysis Ed Confer, KGC Programming Solutions, Potomac Falls, VA Abstract Web based reporting has enhanced the ability of management to interface with data in a point

More information

Many MS Excel Worksheets Read Them Without Typing Their Names Ravi Vaylay, PhD, Cybrid, Inc

Many MS Excel Worksheets Read Them Without Typing Their Names Ravi Vaylay, PhD, Cybrid, Inc Many MS Excel Worksheets Read Them Without Typing Their Names Ravi Vaylay, PhD, Cybrid, Inc Abstract: The objective of this paper is to present a VBA (Visual Basic for Applications) macro in MS Excel and

More information

WESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math

WESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math Textbook Correlation WESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math Following Directions Unit FIRST QUARTER AND SECOND QUARTER Logic Unit

More information

Which of the following is the correct operator to compare two variables? A. := B. = C. equal D. ==

Which of the following is the correct operator to compare two variables? A. := B. = C. equal D. == Group 1 Question 1. What is the correct value to return to the operating system upon the successful completion of a program? A. -1 B. 1 C. 0 D. Programs do not return a value. Question 2. What is the only

More information

Innovative Techniques and Tools to Detect Data Quality Problems

Innovative Techniques and Tools to Detect Data Quality Problems Paper DM05 Innovative Techniques and Tools to Detect Data Quality Problems Hong Qi and Allan Glaser Merck & Co., Inc., Upper Gwynnedd, PA ABSTRACT High quality data are essential for accurate and meaningful

More information

Chapter 5 Programming Statements. Chapter Table of Contents

Chapter 5 Programming Statements. Chapter Table of Contents Chapter 5 Programming Statements Chapter Table of Contents OVERVIEW... 57 IF-THEN/ELSE STATEMENTS... 57 DO GROUPS... 58 IterativeExecution... 59 JUMPING... 61 MODULES... 62 Defining and Executing a Module....

More information

Advanced Tutorials. Numeric Data In SAS : Guidelines for Storage and Display Paul Gorrell, Social & Scientific Systems, Inc., Silver Spring, MD

Advanced Tutorials. Numeric Data In SAS : Guidelines for Storage and Display Paul Gorrell, Social & Scientific Systems, Inc., Silver Spring, MD Numeric Data In SAS : Guidelines for Storage and Display Paul Gorrell, Social & Scientific Systems, Inc., Silver Spring, MD ABSTRACT Understanding how SAS stores and displays numeric data is essential

More information

PharmaSUG 2014 Paper CC23. Need to Review or Deliver Outputs on a Rolling Basis? Just Apply the Filter! Tom Santopoli, Accenture, Berwyn, PA

PharmaSUG 2014 Paper CC23. Need to Review or Deliver Outputs on a Rolling Basis? Just Apply the Filter! Tom Santopoli, Accenture, Berwyn, PA PharmaSUG 2014 Paper CC23 Need to Review or Deliver Outputs on a Rolling Basis? Just Apply the Filter! Tom Santopoli, Accenture, Berwyn, PA ABSTRACT Wouldn t it be nice if all of the outputs in a deliverable

More information

Preparing your data for analysis using SAS. Landon Sego 24 April 2003 Department of Statistics UW-Madison

Preparing your data for analysis using SAS. Landon Sego 24 April 2003 Department of Statistics UW-Madison Preparing your data for analysis using SAS Landon Sego 24 April 2003 Department of Statistics UW-Madison Assumptions That you have used SAS at least a few times. It doesn t matter whether you run SAS in

More information

Going from Python to C

Going from Python to C Going from Python to C Darin Brezeale December 8, 2011 Python is a high-level, interpreted language. C has many of the same types of programming constructs as in Python: arrays, loops, conditionals, functions,

More information

A Technique for Storing and Manipulating Incomplete Dates in a Single SAS Date Value

A Technique for Storing and Manipulating Incomplete Dates in a Single SAS Date Value A Technique for Storing and Manipulating Incomplete Dates in a Single SAS Date Value John Ingersoll Introduction: This paper presents a technique for storing incomplete date values in a single variable

More information

Effectively Utilizing Loops and Arrays in the DATA Step

Effectively Utilizing Loops and Arrays in the DATA Step Paper HW08-2012 Effectively Utilizing Loops and Arrays in the DATA Step Arthur X. Li, City of Hope Comprehensive Cancer Center, Duarte, CA ABSTRACT The implicit loop refers to the DATA step repetitively

More information

Chapter 2: Elements of Java

Chapter 2: Elements of Java Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction

More information

SAS PROGRAM EFFICIENCY FOR BEGINNERS. Bruce Gilsen, Federal Reserve Board

SAS PROGRAM EFFICIENCY FOR BEGINNERS. Bruce Gilsen, Federal Reserve Board SAS PROGRAM EFFICIENCY FOR BEGINNERS Bruce Gilsen, Federal Reserve Board INTRODUCTION This paper presents simple efficiency techniques that can benefit inexperienced SAS software users on all platforms.

More information

Managing Tables in Microsoft SQL Server using SAS

Managing Tables in Microsoft SQL Server using SAS Managing Tables in Microsoft SQL Server using SAS Jason Chen, Kaiser Permanente, San Diego, CA Jon Javines, Kaiser Permanente, San Diego, CA Alan L Schepps, M.S., Kaiser Permanente, San Diego, CA Yuexin

More information

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share. LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

More information

1. Constants. 2. Variables. 3. Reserved words or key words. 4. Constants. Character set in C

1. Constants. 2. Variables. 3. Reserved words or key words. 4. Constants. Character set in C Character set in C We should use only the following characters in writing a C program. These characters can be combined to create C words. Alphabet: A, B, C, D.. Z, a, b, c, d..z Numeric digits: 0, 1,

More information

Paper PO03. A Case of Online Data Processing and Statistical Analysis via SAS/IntrNet. Sijian Zhang University of Alabama at Birmingham

Paper PO03. A Case of Online Data Processing and Statistical Analysis via SAS/IntrNet. Sijian Zhang University of Alabama at Birmingham Paper PO03 A Case of Online Data Processing and Statistical Analysis via SAS/IntrNet Sijian Zhang University of Alabama at Birmingham BACKGROUND It is common to see that statisticians at the statistical

More information

Working with Excel spreadsheets using the SAS/ACCESS LIBNAME statement Gwen Babcock, New York State Department of Health, Albany, NY

Working with Excel spreadsheets using the SAS/ACCESS LIBNAME statement Gwen Babcock, New York State Department of Health, Albany, NY Working with Excel spreadsheets using the SAS/ACCESS LIBNAME statement Gwen Babcock, New York State Department of Health, Albany, NY ABSTRACT SAS programmers often receive data in a Microsoft Excel spreadsheet,

More information

Table Lookups: From IF-THEN to Key-Indexing

Table Lookups: From IF-THEN to Key-Indexing Paper 158-26 Table Lookups: From IF-THEN to Key-Indexing Arthur L. Carpenter, California Occidental Consultants ABSTRACT One of the more commonly needed operations within SAS programming is to determine

More information

A Recursive SAS Macro to Automate Importing Multiple Excel Worksheets into SAS Data Sets

A Recursive SAS Macro to Automate Importing Multiple Excel Worksheets into SAS Data Sets PharmaSUG2011 - Paper CC10 A Recursive SAS Macro to Automate Importing Multiple Excel Worksheets into SAS Data Sets Wenyu Hu, Merck Sharp & Dohme Corp., Upper Gwynedd, PA Liping Zhang, Merck Sharp & Dohme

More information

From The Little SAS Book, Fifth Edition. Full book available for purchase here.

From The Little SAS Book, Fifth Edition. Full book available for purchase here. From The Little SAS Book, Fifth Edition. Full book available for purchase here. Acknowledgments ix Introducing SAS Software About This Book xi What s New xiv x Chapter 1 Getting Started Using SAS Software

More information

Table Lookup: Techniques Beyond the Obvious Nancy Croonen, CC Training Services, Belgium ir. Henri Theuwissen, SOLID Partners, Belgium

Table Lookup: Techniques Beyond the Obvious Nancy Croonen, CC Training Services, Belgium ir. Henri Theuwissen, SOLID Partners, Belgium Paper 11-27 Table Lookup: Techniques Beyond the Obvious Nancy Croonen, CC Training Services, Belgium ir. Henri Theuwissen, SOLID Partners, Belgium ABSTRACT Table lookup operations are often the most time

More information

Project Request and Tracking Using SAS/IntrNet Software Steven Beakley, LabOne, Inc., Lenexa, Kansas

Project Request and Tracking Using SAS/IntrNet Software Steven Beakley, LabOne, Inc., Lenexa, Kansas Paper 197 Project Request and Tracking Using SAS/IntrNet Software Steven Beakley, LabOne, Inc., Lenexa, Kansas ABSTRACT The following paper describes a project request and tracking system that has been

More information

A Macro to Create Data Definition Documents

A Macro to Create Data Definition Documents A Macro to Create Data Definition Documents Aileen L. Yam, sanofi-aventis Inc., Bridgewater, NJ ABSTRACT Data Definition documents are one of the requirements for NDA submissions. This paper contains a

More information

Effective Use of SQL in SAS Programming

Effective Use of SQL in SAS Programming INTRODUCTION Effective Use of SQL in SAS Programming Yi Zhao Merck & Co. Inc., Upper Gwynedd, Pennsylvania Structured Query Language (SQL) is a data manipulation tool of which many SAS programmers are

More information

Aileen L. Yam, PharmaNet, Inc., Princeton, NJ

Aileen L. Yam, PharmaNet, Inc., Princeton, NJ Paper 15-25 SAS SOFTWARE AND MICROSOFT OFFICE VISUAL BASIC FOR APPLICATIONS MAKE BEAUTIFUL REPORTS TOGETHER Aileen L. Yam, PharmaNet, Inc., Princeton, NJ ABSTRACT In pharmaceutical research, clinical study

More information

How to Use SDTM Definition and ADaM Specifications Documents. to Facilitate SAS Programming

How to Use SDTM Definition and ADaM Specifications Documents. to Facilitate SAS Programming How to Use SDTM Definition and ADaM Specifications Documents to Facilitate SAS Programming Yan Liu Sanofi Pasteur ABSTRCT SDTM and ADaM implementation guides set strict requirements for SDTM and ADaM variable

More information

Exercise 1: Python Language Basics

Exercise 1: Python Language Basics Exercise 1: Python Language Basics In this exercise we will cover the basic principles of the Python language. All languages have a standard set of functionality including the ability to comment code,

More information

SUGI 29 Coders' Corner

SUGI 29 Coders' Corner Paper 074-29 Tales from the Help Desk: Solutions for Simple SAS Mistakes Bruce Gilsen, Federal Reserve Board INTRODUCTION In 19 years as a SAS consultant at the Federal Reserve Board, I have seen SAS users

More information

%DIFF: A SAS Macro to Compare Documents in Word or ASCII Format. Michelle Xu and Jay Zhou Amylin Pharmaceuticals, Inc.

%DIFF: A SAS Macro to Compare Documents in Word or ASCII Format. Michelle Xu and Jay Zhou Amylin Pharmaceuticals, Inc. Paper CC09 %DIFF: A SAS Macro to Compare Documents in Word or ASCII Format Michelle Xu and Jay Zhou Amylin Pharmaceuticals, Inc., San Diego, CA ABSTRACT Manually comparing outputs, generated using SAS

More information

Dept. of CSE, IIT KGP

Dept. of CSE, IIT KGP Programming in C: Basics CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Types of variable We must declare the

More information

Importing Excel File using Microsoft Access in SAS Ajay Gupta, PPD Inc, Morrisville, NC

Importing Excel File using Microsoft Access in SAS Ajay Gupta, PPD Inc, Morrisville, NC ABSTRACT PharmaSUG 2012 - Paper CC07 Importing Excel File using Microsoft Access in SAS Ajay Gupta, PPD Inc, Morrisville, NC In Pharmaceuticals/CRO industries, Excel files are widely use for data storage.

More information

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 The Java Type System By now, you have seen a fair amount of Java. Time to study in more depth the foundations of the language,

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

The Mystery of Automatic Retain in a SAS Data Step

The Mystery of Automatic Retain in a SAS Data Step SESUG 2015 Paper CC34 The Mystery of Automatic Retain in a SAS Data Step Huei-Ling Chen, Merck & Co., Inc., Kenilworth, NJ USA Hong Zhang, Eli Lilly and Company, Bridgewater, NJ Patricia Guldin, Merck

More information

First Bytes Programming Lab 2

First Bytes Programming Lab 2 First Bytes Programming Lab 2 This lab is available online at www.cs.utexas.edu/users/scottm/firstbytes. Introduction: In this lab you will investigate the properties of colors and how they are displayed

More information

ABSTRACT INTRODUCTION %CODE MACRO DEFINITION

ABSTRACT INTRODUCTION %CODE MACRO DEFINITION Generating Web Application Code for Existing HTML Forms Don Boudreaux, PhD, SAS Institute Inc., Austin, TX Keith Cranford, Office of the Attorney General, Austin, TX ABSTRACT SAS Web Applications typically

More information

An Approach to Creating Archives That Minimizes Storage Requirements

An Approach to Creating Archives That Minimizes Storage Requirements Paper SC-008 An Approach to Creating Archives That Minimizes Storage Requirements Ruben Chiflikyan, RTI International, Research Triangle Park, NC Mila Chiflikyan, RTI International, Research Triangle Park,

More information

An Introduction to SAS/SHARE, By Example

An Introduction to SAS/SHARE, By Example Paper 020-29 An Introduction to SAS/SHARE, By Example Larry Altmayer, U.S. Census Bureau, Washington, DC ABSTRACT SAS/SHARE software is a useful tool for allowing several users to simultaneously access

More information

Arthur L. Carpenter, California Occidental Consultants, Anchorage, AK

Arthur L. Carpenter, California Occidental Consultants, Anchorage, AK Paper 2221-2015 Quotes within Quotes: When Single ( ) and Double ( ) Quotes are not Enough Arthur L. Carpenter, California Occidental Consultants, Anchorage, AK ABSTRACT Although it does not happen every

More information

THE FUNDAMENTALS OF DATA STEP PROGRAMMING I: THE ESSENCE OF DATA STEP PROGRAMMING Arthur Li, City of Hope Comprehensive Cancer Center, Duarte, CA

THE FUNDAMENTALS OF DATA STEP PROGRAMMING I: THE ESSENCE OF DATA STEP PROGRAMMING Arthur Li, City of Hope Comprehensive Cancer Center, Duarte, CA THE FUNDAMENTALS OF DATA STEP PROGRAMMING I: THE ESSENCE OF DATA STEP PROGRAMMING Arthur Li, City of Hope Comprehensive Cancer Center, Duarte, CA 1.1. COMPILATION AND EXECUTION PHASES A DATA step is processed

More information

Statistics and Analysis. Quality Control: How to Analyze and Verify Financial Data

Statistics and Analysis. Quality Control: How to Analyze and Verify Financial Data Abstract Quality Control: How to Analyze and Verify Financial Data Michelle Duan, Wharton Research Data Services, Philadelphia, PA As SAS programmers dealing with massive financial data from a variety

More information

SAS Macro Autocall and %Include

SAS Macro Autocall and %Include Paper CC-019 SAS Macro Autocall and %Include Jie Huang, Merck & Co., Inc. Tracy Lin, Merck & Co., Inc. ABSTRACT SAS provides several methods to invoke external SAS macros in a SAS program. There are two

More information

Swap the DATA Step for PROC TRANSPOSE Katie Joseph, U.S. Office of Personnel Management, Washington, DC

Swap the DATA Step for PROC TRANSPOSE Katie Joseph, U.S. Office of Personnel Management, Washington, DC Swap the DATA Step for PROC TRANSPOSE Katie Joseph, U.S. Office of Personnel Management, Washington, DC ABSTRACT Anyone who has spent an unspeakable amount of time using arrays and do loops in a DATA step

More information

Performing Macro Iteration on Consecutive Lines of a Dataset Using PROC SQL Syloke J. Soong, Allegro MicroSystems, Inc.

Performing Macro Iteration on Consecutive Lines of a Dataset Using PROC SQL Syloke J. Soong, Allegro MicroSystems, Inc. Performing Macro Iteration on Consecutive Lines of a Dataset Using PROC SQL Syloke J. Soong, Allegro MicroSystems, Inc. Abstract You have a dataset where each line is to be consecutively extracted and

More information

Programming Idioms Using the SET Statement

Programming Idioms Using the SET Statement Programming Idioms Using the SET Statement Jack E. Fuller, Trilogy Consulting Corporation, Kalamazoo, MI ABSTRACT While virtually every programmer of base SAS uses the SET statement, surprisingly few programmers

More information

Reading Delimited Text Files into SAS 9 TS-673

Reading Delimited Text Files into SAS 9 TS-673 Reading Delimited Text Files into SAS 9 TS-673 Reading Delimited Text Files into SAS 9 i Reading Delimited Text Files into SAS 9 Table of Contents Introduction... 1 Options Available for Reading Delimited

More information

PharmaSUG2013 Paper AD11

PharmaSUG2013 Paper AD11 PharmaSUG2013 Paper AD11 Let SAS Set Up and Track Your Project Tom Santopoli, Octagon, now part of Accenture Wayne Zhong, Octagon, now part of Accenture ABSTRACT When managing the programming activities

More information

Simplifying Effective Data Transformation Via PROC TRANSPOSE

Simplifying Effective Data Transformation Via PROC TRANSPOSE ABSTRACT PharmaSUG 2012 - Paper TF03 Simplifying Effective Data Transformation Via PROC TRANSPOSE Arthur X. Li, City of Hope Comprehensive Cancer Center, Duarte, CA You can store data with repeated measures

More information

The programming language C. sws1 1

The programming language C. sws1 1 The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

More information

Python strings. Girls Programming Network School of Information Technologies University of Sydney. Mini-lecture 5

Python strings. Girls Programming Network School of Information Technologies University of Sydney. Mini-lecture 5 Python strings Girls Programming Network School of Information Technologies University of Sydney Mini-lecture 5 Strings raw input Types Summary 2 Outline 1 Strings 2 Reading input with raw input 3 Types

More information

C Compiler Targeting the Java Virtual Machine

C Compiler Targeting the Java Virtual Machine C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the

More information

Data Presentation. Paper 126-27. Using SAS Macros to Create Automated Excel Reports Containing Tables, Charts and Graphs

Data Presentation. Paper 126-27. Using SAS Macros to Create Automated Excel Reports Containing Tables, Charts and Graphs Paper 126-27 Using SAS Macros to Create Automated Excel Reports Containing Tables, Charts and Graphs Tugluke Abdurazak Abt Associates Inc. 1110 Vermont Avenue N.W. Suite 610 Washington D.C. 20005-3522

More information

Macro Quoting. Overview of Macro Quoting CHAPTER 7

Macro Quoting. Overview of Macro Quoting CHAPTER 7 71 CHAPTER 7 Macro Quoting Overview of Macro Quoting 71 Understanding Why Macro Quoting is Necessary 72 Understanding Macro Quoting Functions 72 Passing Parameters That Contain Special Characters and Mnemonics

More information

DBF Chapter. Note to UNIX and OS/390 Users. Import/Export Facility CHAPTER 7

DBF Chapter. Note to UNIX and OS/390 Users. Import/Export Facility CHAPTER 7 97 CHAPTER 7 DBF Chapter Note to UNIX and OS/390 Users 97 Import/Export Facility 97 Understanding DBF Essentials 98 DBF Files 98 DBF File Naming Conventions 99 DBF File Data Types 99 ACCESS Procedure Data

More information

The presentation will include a code review and presentation of reports that appear in both English and Italian.

The presentation will include a code review and presentation of reports that appear in both English and Italian. SAS Reporting in English, ed anche in italiano: A Methodology for Creating Reports in Two Languages Deborah Testa, Seven of Nine Systems, Inc. Studio City, CA ABSTRACT Project Leonardo was a disease management

More information

Tips, Tricks, and Techniques from the Experts

Tips, Tricks, and Techniques from the Experts Tips, Tricks, and Techniques from the Experts Presented by Katie Ronk 2997 Yarmouth Greenway Drive, Madison, WI 53711 Phone: (608) 278-9964 Web: www.sys-seminar.com Systems Seminar Consultants, Inc www.sys-seminar.com

More information

Technical Paper. Reading Delimited Text Files into SAS 9

Technical Paper. Reading Delimited Text Files into SAS 9 Technical Paper Reading Delimited Text Files into SAS 9 Release Information Content Version: 1.1July 2015 (This paper replaces TS-673 released in 2009.) Trademarks and Patents SAS Institute Inc., SAS Campus

More information

C programming. Intro to syntax & basic operations

C programming. Intro to syntax & basic operations C programming Intro to syntax & basic operations Example 1: simple calculation with I/O Program, line by line Line 1: preprocessor directive; used to incorporate code from existing library not actually

More information

The entire SAS code for the %CHK_MISSING macro is in the Appendix. The full macro specification is listed as follows: %chk_missing(indsn=, outdsn= );

The entire SAS code for the %CHK_MISSING macro is in the Appendix. The full macro specification is listed as follows: %chk_missing(indsn=, outdsn= ); Macro Tabulating Missing Values, Leveraging SAS PROC CONTENTS Adam Chow, Health Economics Resource Center (HERC) VA Palo Alto Health Care System Department of Veterans Affairs (Menlo Park, CA) Abstract

More information

CHAPTER 1 Overview of SAS/ACCESS Interface to Relational Databases

CHAPTER 1 Overview of SAS/ACCESS Interface to Relational Databases 3 CHAPTER 1 Overview of SAS/ACCESS Interface to Relational Databases About This Document 3 Methods for Accessing Relational Database Data 4 Selecting a SAS/ACCESS Method 4 Methods for Accessing DBMS Tables

More information

Overview. NT Event Log. CHAPTER 8 Enhancements for SAS Users under Windows NT

Overview. NT Event Log. CHAPTER 8 Enhancements for SAS Users under Windows NT 177 CHAPTER 8 Enhancements for SAS Users under Windows NT Overview 177 NT Event Log 177 Sending Messages to the NT Event Log Using a User-Written Function 178 Examples of Using the User-Written Function

More information