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

Size: px
Start display at page:

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

Transcription

1 Procedure for Stamping Source File Information on SAS Output Elizabeth Molloy & Breda O'Connor, ICON Clinical Research ABSTRACT In the course of producing a report for a clinical trial numerous drafts may be produced and tables and listings may be generated using several different versions of the data and the programs. In order to keep track of the various versions it is advisable to record, at least, the source information relating to the data sets and programs used. This information should preferably appear on the hard copy of the output. While this information may be easily obtained with certain operating systems it is more difficult with SAS for Windows on a PC LAN operating system. Therefore a procedure for printing any or all of the following information on a table or data listing has been devised. Filename, filepath and version date of the program used to produce the output. Version date and location of the data sets used to produce the output. Version of SAS used and the time and date that SAS session was invoked. A userid for the individual responsible for producing the output. INTRODUCTION The filename and filepath of the current program are obtained from the appropriate SQL data view. The CALL SYSTEM command is then used to obtain the version date of the file from DOS. The creation date and location of the data sets used are obtained using the CONTENTS procedure or another SQL data view. This information along with the system time and date are manipulated and output as macro variables for use in 'title' or 'footnote' statements, using the CALL SYMPUT routine. This code may be included in other programs and used to automatically update the source file information every time the output is reproduced. PROC SQL provides the capability to retrieve information about all libraries and external files that are allocated in a session. Dictionary tables are special read-only PROC SQL objects that contain system catalogs for all SAS data sets and other SAS files. For each dictionary table, a PROC SQL view is available in the SASHELP data library. Data views can be thought of as virtual SAS data sets 1 as they do not contain actual data but describe data stored in other file structures. These PROC SQL views can be specified in other procedures and DATA steps, whereas dictionary tables are available only by using the DICTIONARY.TABLES component of the SQL procedure. The following list includes the names of some of the PROC SQL views in the SASHELP library; VCATALG, VEXTFL, VMEMBER, VOPTION, VTABLE etc. DICTIONARY.EXTFILES for example lists external files that are currently associated by filerefs with the SAS session, the corresponding SASHELP view is created using the following code proc sql; create view sashelp.vextfl as select * from dictionary.extfiles; The select statements which define each SASHELP SQL view are given on pages of SAS Technical Report P-222. SAS PROGRAM FILE DETAILS

2 The following code may be used to obtain the filename, filepath & version date of the current SAS program. set sashelp.vextfl; if _n_ = 1 then do; call symput("pgmname",xpath); end; options noxwait noxsync; e call system("dir &pgmname > file.lis"); infile 'file.lis' firstobs=5; if _n_ > 1 then stop; input prefix $ suffix $ size $ date mmddyy9. time $ ; stamp = 'Program left(trim(prefix)) '.' left(trim (suffix)) ' (dated ' put (date,ddmmyy8.) ) ; call symput ('foot',stamp); footnote1 "&foot"; c The filepath is read as the first i.e. latest record from the sashelp view. Note the positioning of this code in the program is important. because the last entry in this view is affected by code inserted into the pgm window as an include statement or programs opened into other windows including notepad If this code is inserted into the program as an include statement then _n_ = 2 selects the path for the original program. d The XWAIT and XSYNC options control what happens when the SAS System exits to DOS. The NOXWAIT option means that the SAS System does not wait for a user response before closing the DOS window. The NOXSYNC options means that control c d f g is returned immediately to the SAS System and the command continues executing without interfering with the SAS session. e The CALL SYSTEM routine is similar to the X command; however, the CALL SYSTEM routine is callable and can therefore be executed conditionally. The file.lis text file created in the working directory has the following format; Volume in drive H is SYS Directory of H:\MOLLOYB\SAS SQL SAS 2, :11p file(s) 2,154 bytes dir(s) 1,560,903,680 bytes free f The fifth line of this text file provides the required file details which are read in with a list style input statement. The layout of this text file, e.g. the date format may be host specific and should be checked. g The date is written in American format and is read in using the mmddyyw. informat so as to be stored as a SAS date. SAS DATASET DETAILS Details of data sets in data libraries associated with the SAS session may be obtained using the SASHELP.VTABLE data view, or also by using the CONTENTS procedure. Several permanent data sets may be used in any one program. The creation date for each of these could be obtained but this would require a significant amount of explicit programming within each program. An alternative would be to chose one data set which is significant to each program and is most likely to be updated when new data is obtained. The name of

3 this data set is then assigned as the keydata macro variable and the creation date for this data set obtained using the following code. %let keydata = LIBRAW.DEMO; proc contents noprint data=&keydata out=temp(keep=crdate); data temp; set temp; if _n_ = 1; OR set sashelp.vtable; where libname = put(scan("&keydata",1),$8.) and memname = put(scan("&keydata",2),$8.); footnote2 "Data sets created &crdate"; SAS SESSION DETAILS When SAS is invoked a set of automatic macro variables is created, these include; SYSDATE - Date when job or session started execution. SYSDAY - The current day of the week as a word. SYSTIME - Returns the time SAS was invoked or a batch job started execution. SYSVER - Returns the version of the SAS System being used e.g These automatic system macro variables can be manipulated as required and included in the output. tdate = put("&sysdate"d,worddate12.); call symput ('newdate', tdate); title "&newdate"; PROGRAM USERID In order to provide an audit trail for SAS jobs it is important to try and identify the SAS user who has been involved in running the program, however there is no straightforward way to find this information from within the SAS system. The following example makes use of the programmer s personal directory on the network. In our company this home directory is assigned as the working directory for SAS so that personal SAS profiles can be saved there and so as to avoid conflicts when multiple users invoke SAS. This code uses the PROC SQL function to read part of the SASUSER directory path into a macro variable which denotes the userid. The scan function selects the second word in the filepath, using the backslash as the word delimiter. This information could also been obtained from the SASHELP. VMEMBERS SQL view. proc sql; select scan(path,2,'\') into :userid from dictionary.members where libname = 'SASUSER' and memname = 'PROFILE'; quit; Obviously this method of obtaining a userid is host specific and depends on the network set-up etc. Alternatives include obtaining the login ID of a user as a DOS environment variable or by accessing routines that reside inside network specific dynamic link libraries (DLLs). These methods are described by David Barron 2 in the SAS Observations magazine.

4 PROGRAM EXAMPLE The program presented in attachment 1 combines all of the code modules outlined above and builds a set of footnotes and titles which illustrate how a SAS table can be stamped with the source file information. CONCLUSION Obtaining information on which program was used to produce a certain table or graph, when it was run and by whom, is vital to keeping track of different versions of SAS output. While all of these items could be entered manually into a program, it is likely that they will not always be correctly updated when programs are being re-run or copied. By manipulating information that is readily available in SQL data views and automatic system macro variables the important source file information can be obtained automatically every time a program is run. Printing this information on SAS output, using the type of code described above, enhances the output and facilitates version control and auditing procedures. Author contact : Elizabeth Molloy ICON Clinical Research South County Business Park Leopardstown Dublin 18 Ireland. molloyb@iconirl.com SAS is the registered trademark of SAS Institute Inc., Cary, NC. 1 Boling J.C., SAS Data Views : A Virtual View of Data, SAS Observations, 3 rd Quarter Barron David, Input/Output, 57-59, SAS Observations, 3 rd Quarter Attachment 1 /* Program to illustrate the stamping of Source File Information on SAS Output. This program is save in the c:\temp\progs directory*/ options ls=80 ps=50 nodate nonumber nocenter; title ' '; footnote ' '; /* To create two datasets to be put into a permenant library */

5 libname libraw 'c:\temp\datasets'; %let keydata = LIBRAW.DEMO; data libraw.name; input number name $ sex $; cards; 1 ALFRED M 2 ALICE F 3 BARBARA F 4 CAROL F 5 HENRY M 6 JAMES M 7 JANE F 8 JANET F 9 JEFFREY M 10 JOHN M data libraw.demo; input number age height weight; cards; /* This section of code defines the automatically updated footnotes */ set sashelp.vextfl; if _n_ = 1 then do; call symput("pgmname",xpath); end; options noxwait noxsync; call system("dir &pgmname > file.lis"); infile 'file.lis' firstobs=5; if _n_ > 1 then stop; /* This code could also be inserted as an include statement */ title " Listing of Demographic Details"; footnote1 "&foot" ; footnote2 "run by &userid with SAS &sysver on &sysdate"; footnote3 "using Data sets created &crdate"; data all noobs; merge libraw.name libraw.demo; by number; proc print noobs; dm pgm 'pgm; recall; file "c:\temp\progs\stamplis.sas"'; SAS Output Listing of Demographic Details OBS NUMBER NAME SEX AGE HEIGHT WEIGHT 1 1 ALFRED M ALICE F BARBARA F CAROL F HENRY M JAMES M JANE F JANET F JEFFREY M JOHN M input prefix $ suffix $ size $ date mmddyy9. time $ ; stamp = 'Program ' left(trim(prefix)) '.' left(trim (suffix)) ' (dated ' put (date,ddmmyy8.) ')'; call symput ('foot',stamp); Program STAMPLIS.SAS (dated 26/03/97) run by MOLLOYB with SAS 6.11 on 26MAR97 using Data sets created 26MAR97:17:41:54 proc contents noprint data=&keydata out=temp(keep=crdate); data temp; set temp; if _n_ = 1; proc sql noprint; select put(scan(path,2,'\'),$8.) into :userid from dictionary.members where libname = 'SASUSER' and memname = 'PROFILE'; quit;

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

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

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

More information

PROGRAMMING WHEN YOU DON T KNOW OBJECT NAMES: AN INTRO TO DICTIONARIES

PROGRAMMING WHEN YOU DON T KNOW OBJECT NAMES: AN INTRO TO DICTIONARIES Paper TT26 Meta Data That You (Probably) Didn t Know That You Had: A Beginners Guide to Using SAS Dictionaries and Automatic Macro Variables Richard F. Pless, Ovation Research Group, Highland Park, IL

More information

Exploring DICTIONARY Tables and SASHELP Views

Exploring DICTIONARY Tables and SASHELP Views Exploring DICTIONARY Tables and SASHELP Views Kirk Paul Lafler, Software Intelligence Corporation Abstract SAS users can quickly and conveniently obtain useful information about their SAS session with

More information

A Better Perspective of SASHELP Views

A Better Perspective of SASHELP Views Paper PO11 A Better Perspective of SASHELP Views John R. Gerlach, Independent Consultant; Hamilton, NJ Abstract SASHELP views provide a means to access all kinds of information about a SAS session. In

More information

Why & How To Use SAS Macro Language: Easy Ways To Get More Value & Power from Your SAS Software Tools

Why & How To Use SAS Macro Language: Easy Ways To Get More Value & Power from Your SAS Software Tools Why & How To Use SAS Macro Language: Easy Ways To Get More Value & Power from Your SAS Software Tools LeRoy Bessler PhD Bessler Consulting and Research Strong Smart Systems Mequon, WI, USA Le_Roy_Bessler@wi.rr.com

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

Why Is This Subject Important? You Could Look It Up: An Introduction to SASHELP Dictionary Views. What Information is Listed in Dictionary Tables?

Why Is This Subject Important? You Could Look It Up: An Introduction to SASHELP Dictionary Views. What Information is Listed in Dictionary Tables? You Could Look It Up: An Introduction to SASHELP Dictionary Views Michael L. Davis Bassett Consulting Services, Inc. September 13, 2000 Why Is This Subject Important? many experienced SAS users have never

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

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

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

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

More information

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

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

SAS Data Libraries. Definition CHAPTER 26

SAS Data Libraries. Definition CHAPTER 26 385 CHAPTER 26 SAS Data Libraries Definition 385 Library Engines 387 Library Names 388 Physical Names and Logical Names (Librefs) 388 Assigning Librefs 388 Associating and Clearing Logical Names (Librefs)

More information

Review of PC-SAS Batch Programming

Review of PC-SAS Batch Programming Ronald J. Fehd September 21, 2007 Abstract This paper presents an overview of issues of usage of PC-SAS R in a project directory. Topics covered include directory structures, how to start SAS in a particular

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

Paper SE04 Dynamic SAS Programming Techniques, or How NOT to Create Job Security Steven Beakley and Suzanne McCoy

Paper SE04 Dynamic SAS Programming Techniques, or How NOT to Create Job Security Steven Beakley and Suzanne McCoy Introduction Paper SE04 Dynamic SAS Programming Techniques, or How NOT to Create Job Security Steven Beakley and Suzanne McCoy Many SAS programmers, particularly consultants, joke about creating job security

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

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 a HASH Table to Reference Variables in an Array by Name. John Henry King, Hopper, Arkansas

Using a HASH Table to Reference Variables in an Array by Name. John Henry King, Hopper, Arkansas PharmaSUG 2011 - Paper TT04 Using a HASH Table to Reference Variables in an Array by Name John Henry King, Hopper, Arkansas ABSTRACT Array elements are referenced by their index value using a constant,

More information

Make Your Life a Little Easier: A Collection of SAS Macro Utilities. Pete Lund, Northwest Crime and Social Research, Olympia, WA

Make Your Life a Little Easier: A Collection of SAS Macro Utilities. Pete Lund, Northwest Crime and Social Research, Olympia, WA Make Your Life a Little Easier: A Collection of SAS Macro Utilities Pete Lund, Northwest Crime and Social Research, Olympia, WA ABSTRACT SAS Macros are used in a variety of ways: to automate the generation

More information

Automate Secure Transfers with SAS and PSFTP

Automate Secure Transfers with SAS and PSFTP SESUG Paper 115-2017 Automate Secure Transfers with SAS and PSFTP Kyle Thompson, PPD, Morrisville, NC Kenneth W. Borowiak, PPD, Morrisville, NC INTRODUCTION The ability to transfer files between remote

More information

Windows: SPX Access Method

Windows: SPX Access Method 403 CHAPTER 28 Windows: SPX Access Method SAS Support for SPX on Windows 403 Tasks That Are Common to SAS/CONNECT and SAS/SHARE 404 System and Software Requirements for SAS/CONNECT and SAS/SHARE 404 Windows

More information

What Is SAS? CHAPTER 1 Essential Concepts of Base SAS Software

What Is SAS? CHAPTER 1 Essential Concepts of Base SAS Software 3 CHAPTER 1 Essential Concepts of Base SAS Software What Is SAS? 3 Overview of Base SAS Software 4 Components of the SAS Language 4 SAS Files 4 SAS Data Sets 5 External Files 5 Database Management System

More information

SAS Viya 3.1 FAQ for Processing UTF-8 Data

SAS Viya 3.1 FAQ for Processing UTF-8 Data SAS Viya 3.1 FAQ for Processing UTF-8 Data Troubleshooting Tips for Processing UTF-8 Data (Existing SAS Code) What Is the Encoding of My Data Set? PROC CONTENTS displays information about the data set

More information

ECLT 5810 SAS Programming - Introduction

ECLT 5810 SAS Programming - Introduction ECLT 5810 SAS Programming - Introduction Why SAS? Able to process data set(s). Easy to handle multiple variables. Generate useful basic analysis Summary statistics Graphs Many companies and government

More information

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

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

More information

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

Top Coding Tips. Neil Merchant Technical Specialist - SAS

Top Coding Tips. Neil Merchant Technical Specialist - SAS Top Coding Tips Neil Merchant Technical Specialist - SAS Bio Work in the ANSWERS team at SAS o Analytics as a Service and Visual Analytics Try before you buy SAS user for 12 years obase SAS and O/S integration

More information

Creating and Executing Stored Compiled DATA Step Programs

Creating and Executing Stored Compiled DATA Step Programs 465 CHAPTER 30 Creating and Executing Stored Compiled DATA Step Programs Definition 465 Uses for Stored Compiled DATA Step Programs 465 Restrictions and Requirements 466 How SAS Processes Stored Compiled

More information

Chapter 1: Introduction to SAS

Chapter 1: Introduction to SAS Chapter 1: Introduction to SAS SAS programs: A sequence of statements in a particular order. Rules for SAS statements: 1. Every SAS statement ends in a semicolon!!!; 2. Upper/lower case does not matter

More information

Reading and Writing Data from Microsoft Excel/Word Using DDE

Reading and Writing Data from Microsoft Excel/Word Using DDE Reading and Writing Data from Microsoft Excel/Word Using DDE The DDE Triplet is then incorporated into a Filename statement of the following form: FILENAME fileref DDE 'DDE-Triplet' 'CLIPBOARD' ;

More information

Using Dynamic Data Exchange

Using Dynamic Data Exchange 145 CHAPTER 8 Using Dynamic Data Exchange Overview of Dynamic Data Exchange 145 DDE Syntax within SAS 145 Referencing the DDE External File 146 Determining the DDE Triplet 146 Controlling Another Application

More information

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

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

More information

David Ghan SAS Education

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

More information

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

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

Storing and Reusing Macros

Storing and Reusing Macros 101 CHAPTER 9 Storing and Reusing Macros Introduction 101 Saving Macros in an Autocall Library 102 Using Directories as Autocall Libraries 102 Using SAS Catalogs as Autocall Libraries 103 Calling an Autocall

More information

SAS/Warehouse Administrator Usage and Enhancements Terry Lewis, SAS Institute Inc., Cary, NC

SAS/Warehouse Administrator Usage and Enhancements Terry Lewis, SAS Institute Inc., Cary, NC SAS/Warehouse Administrator Usage and Enhancements Terry Lewis, SAS Institute Inc., Cary, NC ABSTRACT SAS/Warehouse Administrator software makes it easier to build, maintain, and access data warehouses

More information

Introduction to the SAS Macro Facility

Introduction to the SAS Macro Facility Introduction to the SAS Macro Facility Uses for SAS Macros The macro language allows for programs that are dynamic capable of selfmodification. The major components of the macro language include: Macro

More information

Syntax Conventions for SAS Programming Languages

Syntax Conventions for SAS Programming Languages Syntax Conventions for SAS Programming Languages SAS Syntax Components Keywords A keyword is one or more literal name components of a language element. Keywords are uppercase, and in reference documentation,

More information

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

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

More information

Exporting & Importing Datasets & Catalogs: Utility Macros

Exporting & Importing Datasets & Catalogs: Utility Macros Exporting & Importing Datasets & Catalogs: Utility Macros Adel Fahmy, SYSMART Consulting, North Brunswick, NJ ABSTRACT Since different companies use different SAS versions installed on different platforms,

More information

Chapter 1 The DATA Step

Chapter 1 The DATA Step Chapter 1 The DATA Step 1.1 Structure of SAS Programs...1-3 1.2 SAS Data Sets... 1-12 1.3 Creating a Permanent SAS Data Set... 1-18 1.4 Writing a SAS DATA Step... 1-24 1.5 Creating a DATA Step View...

More information

Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi

Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi Contents Part 1 Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi Macro Basics Chapter 1 Introduction 3 1.1 Macro Facility Overview 3 1.2 Terminology

More information

Programming Tips and Examples for Your Toolkit, III John Morrill, Pharmion Corporation, Overland Park, KS

Programming Tips and Examples for Your Toolkit, III John Morrill, Pharmion Corporation, Overland Park, KS Paper TT15 Programming Tips and Examples for Your Toolkit, III John Morrill, Pharmion Corporation, Overland Park, KS ABSTRACT This paper is a continuation of a series of PharmaSUG papers containing several

More information

Paper This paper reviews these techniques and demonstrates them through a series of examples.

Paper This paper reviews these techniques and demonstrates them through a series of examples. Paper 2220-2015 Are You a Control Freak? Control Your Programs Don t Let Them Control You! Mary F. O. Rosenbloom, Edwards Lifesciences LLC, Irvine, CA Art Carpenter, California Occidental Consultants,

More information

Customizing Your SAS Session

Customizing Your SAS Session 13 CHAPTER 2 Customizing Your SAS Session Introduction 13 Specifying System Options in the SAS Command 14 Configuration Files 15 Creating a User Configuration File 15 Specifying a User Configuration File

More information

SAS File Management. Improving Performance CHAPTER 37

SAS File Management. Improving Performance CHAPTER 37 519 CHAPTER 37 SAS File Management Improving Performance 519 Moving SAS Files Between Operating Environments 520 Converting SAS Files 520 Repairing Damaged Files 520 Recovering SAS Data Files 521 Recovering

More information

SAS Catalogs. Definition. Catalog Names. Parts of a Catalog Name CHAPTER 32

SAS Catalogs. Definition. Catalog Names. Parts of a Catalog Name CHAPTER 32 479 CHAPTER 32 SAS Catalogs Definition 479 Catalog Names 479 Parts of a Catalog Name 479 Accessing Information in Catalogs 480 Tools for Managing Catalogs 480 User Profile Catalog 481 Definition 481 How

More information

Initializing and Configuring the SAS System

Initializing and Configuring the SAS System 3 CHAPTER 1 Initializing and Configuring the SAS System Invoking SAS in the OS/390 Environment 4 Invoking SAS under TSO: the SAS CLIST 4 Invoking SAS in Batch Mode: the SAS Cataloged Procedure 5 Logging

More information

Base and Advance SAS

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

More information

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

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

Example1D.1.sas. * Procedures : ; * 1. print to show the dataset. ;

Example1D.1.sas. * Procedures : ; * 1. print to show the dataset. ; Example1D.1.sas * SAS example program 1D.1 ; * 1. Create a dataset called prob from the following data: ; * age prob lb ub ; * 24.25.20.31 ; * 36.26.21.32 ; * 48.28.24.33 ; * 60.31.28.36 ; * 72.35.32.39

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

ODS in an Instant! Bernadette H. Johnson, The Blaze Group, Inc., Raleigh, NC

ODS in an Instant! Bernadette H. Johnson, The Blaze Group, Inc., Raleigh, NC Paper 210-28 ODS in an Instant! Bernadette H. Johnson, The Blaze Group, Inc., Raleigh, NC ABSTRACT Do you need to generate high impact word processor, printer- or web- ready output? Want to skip the SAS

More information

DATA Step Debugger APPENDIX 3

DATA Step Debugger APPENDIX 3 1193 APPENDIX 3 DATA Step Debugger Introduction 1194 Definition: What is Debugging? 1194 Definition: The DATA Step Debugger 1194 Basic Usage 1195 How a Debugger Session Works 1195 Using the Windows 1195

More information

An Introduction to SAS Macros Steven First, Systems Seminar Consultants, Madison, WI

An Introduction to SAS Macros Steven First, Systems Seminar Consultants, Madison, WI Paper 153-26 An Introduction to SAS Macros Steven First, Systems Seminar Consultants, Madison, WI Abstract The SAS programming language has a rich tool-box of features that can offer a lot of power to

More information

A Macro To Generate a Study Report Hany Aboutaleb, Biogen Idec, Cambridge, MA

A Macro To Generate a Study Report Hany Aboutaleb, Biogen Idec, Cambridge, MA Paper PO26 A Macro To Generate a Study Report Hany Aboutaleb, Biogen Idec, Cambridge, MA Abstract: Imagine that you are working on a study (project) and you would like to generate a report for the status

More information

The Missing Semicolon

The Missing Semicolon The Missing Semicolon TECHNICAL ASSISTANCE FOR THE SAS SOFTWARE PROFESSIONAL Volume 3, Number 3 July, 2000 DICTIONARY TABLES - DATA ABOUT YOUR DATA A component was added in SAS Version 6.07 called dictionary

More information

Using SAS Files CHAPTER 3

Using SAS Files CHAPTER 3 55 CHAPTER 3 Using SAS Files Introduction to SAS Files 56 What Is a SAS File? 56 Types of SAS Files 57 Using Short or Long File Extensions in SAS Libraries 58 SAS Data Sets (Member Type: Data or View)

More information

Introduction to SQL 4/24/2017. University of Iowa SAS Users Group. 1. Introduction and basic uses 2. Joins and Views 3. Reporting examples

Introduction to SQL 4/24/2017. University of Iowa SAS Users Group. 1. Introduction and basic uses 2. Joins and Views 3. Reporting examples University of Iowa SAS Users Group 1. Introduction and basic uses 2. Joins and Views 3. Reporting examples 1 Patient Sex YOB Blood Type Visit # Weight Joe male 73 A+ 1 150 Joe male 73 A+ 2 153 Joe male

More information

Efficiency Programming with Macro Variable Arrays

Efficiency Programming with Macro Variable Arrays ABSTRACT MWSUG 2018 - Paper SP-062 Efficiency Programming with Macro Variable Arrays Veronica Renauldo, QST Consultations, LTD, Allendale, MI Macros in themselves boost productivity and cut down on user

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

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

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

More information

Moving Data and Results Between SAS and Excel. Harry Droogendyk Stratia Consulting Inc.

Moving Data and Results Between SAS and Excel. Harry Droogendyk Stratia Consulting Inc. Moving Data and Results Between SAS and Excel Harry Droogendyk Stratia Consulting Inc. Introduction SAS can read ( and write ) anything Introduction In the end users want EVERYTHING in. Introduction SAS

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

Efficiently Join a SAS Data Set with External Database Tables

Efficiently Join a SAS Data Set with External Database Tables ABSTRACT Paper 2466-2018 Efficiently Join a SAS Data Set with External Database Tables Dadong Li, Michael Cantor, New York University Medical Center Joining a SAS data set with an external database is

More information

A Way to Work with Invoice Files in SAS

A Way to Work with Invoice Files in SAS A Way to Work with Invoice Files in SAS Anjan Matlapudi and J. Daniel Knapp Pharmacy Informatics, PerformRx, The Next Generation PBM, 200 Stevens Drive, Philadelphia, PA 19113 ABSTRACT This paper illustrates

More information

DSCI 325: Handout 2 Getting Data into SAS Spring 2017

DSCI 325: Handout 2 Getting Data into SAS Spring 2017 DSCI 325: Handout 2 Getting Data into SAS Spring 2017 Data sets come in many different formats. In some situations, data sets are stored on paper (e.g., surveys) and other times data are stored in huge

More information

OS/2: SPX Access Method

OS/2: SPX Access Method 233 CHAPTER 16 OS/2: SPX Access Method SAS Support for SPX on OS/2 233 Tasks That Are Common to SAS/CONNECT and SAS/SHARE 233 System and Software Requirements for SAS/CONNECT and SAS/SHARE 234 Setting

More information

SAS/ACCESS Interface to R/3

SAS/ACCESS Interface to R/3 9.1 SAS/ACCESS Interface to R/3 User s Guide The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2004. SAS/ACCESS 9.1 Interface to R/3: User s Guide. Cary, NC: SAS Institute

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

e. That's accomplished with:

e. That's accomplished with: Make Your Life a Little Easier: A Collection of SAs Macro Utilities Pete Lund, Northwest Crime and Social Research, Olympia, WA ABSTRACT SAs Macros are used in a variety of ways: to automate the generation

More information

Using SAS software to fulfil an FDA request for database documentation

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

More information

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

Hidden in plain sight: my top ten underpublicized enhancements in SAS Versions 9.2 and 9.3

Hidden in plain sight: my top ten underpublicized enhancements in SAS Versions 9.2 and 9.3 Hidden in plain sight: my top ten underpublicized enhancements in SAS Versions 9.2 and 9.3 Bruce Gilsen, Federal Reserve Board, Washington, DC ABSTRACT SAS Versions 9.2 and 9.3 contain many interesting

More information

Reading and Writing Data from Microsoft ExcellWord Using DDE Prepared by Destiny Corporation

Reading and Writing Data from Microsoft ExcellWord Using DDE Prepared by Destiny Corporation Reading and Writing Data from Microsoft ExcellWord Using DDE Prepared by Destiny Corporation Dynamic Data Exchange to Excel Dynamic Data Exchange is a means of transferring data between different Windows

More information

DESCRIPTION OF THE PROJECT

DESCRIPTION OF THE PROJECT Skinning the Cat This Way and That: Using ODS to Create Word Documents That Work for You Elizabeth Axelrod, Abt Associates Inc., Cambridge, MA David Shamlin, SAS Institute Inc., Cary, NC ABSTRACT By supporting

More information

Chapter 7 File Access. Chapter Table of Contents

Chapter 7 File Access. Chapter Table of Contents Chapter 7 File Access Chapter Table of Contents OVERVIEW...105 REFERRING TO AN EXTERNAL FILE...105 TypesofExternalFiles...106 READING FROM AN EXTERNAL FILE...107 UsingtheINFILEStatement...107 UsingtheINPUTStatement...108

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

CHAPTER 7 Using Other SAS Software Products

CHAPTER 7 Using Other SAS Software Products 77 CHAPTER 7 Using Other SAS Software Products Introduction 77 Using SAS DATA Step Features in SCL 78 Statements 78 Functions 79 Variables 79 Numeric Variables 79 Character Variables 79 Expressions 80

More information

A Practical Introduction to SAS Data Integration Studio

A Practical Introduction to SAS Data Integration Studio ABSTRACT A Practical Introduction to SAS Data Integration Studio Erik Larsen, Independent Consultant, Charleston, SC Frank Ferriola, Financial Risk Group, Cary, NC A useful and often overlooked tool which

More information

Surviving the SAS Macro Jungle by Using Your Own Programming Toolkit Kevin Russell, SAS Institute Inc., Cary, North Carolina

Surviving the SAS Macro Jungle by Using Your Own Programming Toolkit Kevin Russell, SAS Institute Inc., Cary, North Carolina PharmaSUG 2016 Paper BB11 Surviving the SAS Macro Jungle by Using Your Own Programming Toolkit Kevin Russell, SAS Institute Inc., Cary, North Carolina ABSTRACT Almost every night there is a reality show

More information

Using SAS Files. Introduction to SAS Files, Data Libraries, and Engines CHAPTER 4

Using SAS Files. Introduction to SAS Files, Data Libraries, and Engines CHAPTER 4 83 CHAPTER 4 Using SAS Files Introduction to SAS Files, Data Libraries, and Engines 83 Types of SAS Files 84 SAS Data Files (Member Type DATA) 85 SAS Data Views (Member Type VIEW) 85 Filename Extensions

More information

Batch Importing. Overview CHAPTER 4

Batch Importing. Overview CHAPTER 4 45 CHAPTER 4 Batch Importing Overview 45 Implementation 46 Specifying the Input Parameters 46 The IMP_TYPE Macro Variable 46 INFILE Macro Variable or Required Filerefs 47 NIDVARS and IDVARn Macro Variables

More information

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

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

More information

;... _... name; tsoge. scr purpose: Startup a TSO SAS session. notes: Assumes the TSO session has been logged on manually.

;... _... name; tsoge. scr purpose: Startup a TSO SAS session. notes: Assumes the TSO session has been logged on manually. AUTOMATING THE PROCESS OF DOWNLOADING SAS DATA SETS TO THE PC Bruce Nawrocki, GE Capital Mortgage Insurance Introduction The [nfonn.tion Center at GE Capital Mortgage Insurance supports about 50 people

More information

Your Own SAS Macros Are as Powerful as You Are Ingenious

Your Own SAS Macros Are as Powerful as You Are Ingenious Paper CC166 Your Own SAS Macros Are as Powerful as You Are Ingenious Yinghua Shi, Department Of Treasury, Washington, DC ABSTRACT This article proposes, for user-written SAS macros, separate definitions

More information

Improving Your Relationship with SAS Enterprise Guide Jennifer Bjurstrom, SAS Institute Inc.

Improving Your Relationship with SAS Enterprise Guide Jennifer Bjurstrom, SAS Institute Inc. ABSTRACT Paper BI06-2013 Improving Your Relationship with SAS Enterprise Guide Jennifer Bjurstrom, SAS Institute Inc. SAS Enterprise Guide has proven to be a very beneficial tool for both novice and experienced

More information

Running Multiple SAS/AF Applications in a Single SAS Session Mark L. Schneider, SAS Institute Inc., Cary, NC

Running Multiple SAS/AF Applications in a Single SAS Session Mark L. Schneider, SAS Institute Inc., Cary, NC Running Multiple SAS/AF Applications in a Single SAS Session Mark L. Schneider, SAS Institute Inc., Cary, NC ABSTRACT For years internal users of Institute tools have been struggling with the startup time

More information

Paper AP14 Modifying The LogParse PassInfo Macro to Provide a Link between Product Usage in Rtrace Log and Time Used in Job Log

Paper AP14 Modifying The LogParse PassInfo Macro to Provide a Link between Product Usage in Rtrace Log and Time Used in Job Log Paper AP14 Modifying The LogParse PassInfo Macro to Provide a Link between Product Usage in Rtrace Log and Time Used in Job Log Ronald J. Fehd, Centers for Disease Control and ention, Atlanta, GA, USA

More information

Doing More with SAS/ASSIST 9.1

Doing More with SAS/ASSIST 9.1 Doing More with SAS/ASSIST 9.1 SAS Documentation The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2003. Doing More With SAS /ASSIST 9.1. Cary, NC: SAS Institute Inc.

More information

You Could Look It Up: An Introduction to SASHELP Dictionary Views

You Could Look It Up: An Introduction to SASHELP Dictionary Views You Could Look It Up: An Introduction to SASHELP Dictionary Views Michael Davis, Bassett Consulting Services, North Haven, Connecticut ABSTRACT Ever wonder what titles were already set in a batch SAS session?

More information

Locking SAS Data Objects

Locking SAS Data Objects 59 CHAPTER 5 Locking SAS Data Objects Introduction 59 Audience 60 About the SAS Data Hierarchy and Locking 60 The SAS Data Hierarchy 60 How SAS Data Objects Are Accessed and Used 61 Types of Locks 62 Locking

More information

Using SAS Files CHAPTER 3

Using SAS Files CHAPTER 3 77 CHAPTER 3 Using SAS Files Introduction to SAS Files 78 What Is a SAS File? 78 Types of SAS Files 79 Using Short or Long File Extensions in SAS Libraries 80 SAS Data Sets (Member Type: Data or View)

More information

The Art of Defensive Programming: Coping with Unseen Data

The Art of Defensive Programming: Coping with Unseen Data INTRODUCTION Paper 1791-2018 The Art of Defensive Programming: Coping with Unseen Data Philip R Holland, Holland Numerics Limited, United Kingdom This paper discusses how you cope with the following data

More information

Why & How To Use SAS Macro Language: Easy Ways To Get More Value & Power from Your SAS Software Tools

Why & How To Use SAS Macro Language: Easy Ways To Get More Value & Power from Your SAS Software Tools Why & How To Use SAS Macro Language: Easy Ways To Get More Value & Power from Your SAS Software Tools Le_Roy_Bessler@wi.rr.com Bessler Consulting and Research Strong Smart Systems Visual Data Insights

More information

ODS DOCUMENT, a practical example. Ruurd Bennink, OCS Consulting B.V., s-hertogenbosch, the Netherlands

ODS DOCUMENT, a practical example. Ruurd Bennink, OCS Consulting B.V., s-hertogenbosch, the Netherlands Paper CC01 ODS DOCUMENT, a practical example Ruurd Bennink, OCS Consulting B.V., s-hertogenbosch, the Netherlands ABSTRACT The ODS DOCUMENT destination (in short ODS DOCUMENT) is perhaps the most underutilized

More information