Wonderful Unix SAS Scripts: SAS Quickies for Dummies Raoul Bernal, Amgen Inc., Thousand Oaks, CA
|
|
- Barnaby Stephens
- 6 years ago
- Views:
Transcription
1 PharmaSUG Paper CC25 Wonderful Unix SAS Scripts: SAS Quickies for Dummies Raoul Bernal, Amgen Inc., Thousand Oaks, CA ABSTRACT Repeated simple SAS jobs can be executed online and in real-time to avoid having to directly execute SAS command files, producing immediate results directly into any Unix display window. The trick is to simulate SAS using Unix scripts, which can be executed just like any Unix command with minimum of one or two parameters. One advantage of making such SAS Unix scripts available is the quick access to SAS without having to learn actual SAS syntax. This reduces the number of exploratory data requests from non-regular SAS users, thereby empowering them to get quickie exploratory results without having to ask a SAS practitioner. Just like any Unix command, the results can be directed to an output file (other than the default output screen) for reporting. INTRODUCTION Imagine getting ad hoc or last minute request from your supervisor to produce a quick report to generate database records with specific criteria, or to generate a count of subjects meeting certain criteria, etc. Imagine if all you have to do to fulfill this type of request is to type any of the following: pp dataset condition pf dataset "catvar1*catvar2" condition pu dataset contvar1 condition pc dataset One way to minimize ad hoc requests is to empower non-sas-trained colleagues and co-workers to use tailored Unix shell scripts to generate their own reports for their simple queries. The simpler the query, the more applicable the Unix SAS shell script could be to address the query and provide the needed statistics. This paper will demonstrate the power and ease behind Unix shell scripts for SAS and provide examples of applications using the simple scripts pp, pf, pu, and pc for SAS procedures PROC PRINT, PROC FREQ and PROC UNIVARIATE and PROC CONTENTS, respectively. By the end of the presentation, one should be able to create simple Unix shell scripts for SAS and realize their relative ease and time-saving features. CREATING A SIMPLE UNIX SCRIPT A simple Unix script is composed of a simple command executable in the Unix operating system, with optional parameters. An example script would be one that lists all files in a current directory, by time: ls last *.* Instead of typing this command, a simple executable script that contains this line, say, fl (for file list) can be saved in utilities folder so that typing fl essentially produces the same results as ls -last *.*.. CREATING SIMPLE SAS UNIX SCRIPTS Creating a SAS Unix script would be more complicated than the simplest Unix command because we need to specify: a) the SAS procedure, b) the dataset to apply the procedure to, and optionally, c) any condition and option to apply to the dataset. Moreover, we need to create a temporary behind-the-scenes SAS job to execute in the background after executing the SAS Unix script in the command line. The objective is to create a SAS Unix script, which, when executed with required dataset, condition and optional parameters, would be equivalent to executing a SAS job using the same SAS procedure. Examples of SAS Unix scripts will be discussed in detail. A. SAS UNIX SCRIPT pp Command syntax: pp dataset condition 1
2 This script pp (short for proc print), when executed with parameters dataset and condition, would be equivalent to the execution of the following PROC PRINT code in SAS: proc print data=dataset width=min; where (condition); run; As an example, printing all the patient records in cohort A1 in the demo.sas7bdat dataset would simply require the following command: pp demo cohort= A1 which yields the following result: Figure 1. Results generated after executing pp example. The straightforward Unix script for pp would be: #!/bin/csh -f # pp - prints out all or part of a UNIX dataset using PROC PRINT # The first argument is the dataset set dataset="$1" # The second argument is for setting condition to subset the data set condition="$2" # Find the dataset file set pwd=`pwd` if (-f $dataset.sas7bdat == 1) then set sasdir = "$pwd" echo "Dataset: $dataset.sas7bdat not found. Exiting... " # Begin constructing the SAS program in the temporary directory /tmp echo "%*include 'init.sas' ;" >! /tmp/pp$$.sas echo "libname sasdata '$sasdir' ;" # Continue constructing the program echo "options nodate nocenter nofmterr pagesize=74 linesize=132 ;" echo "proc printto file='/tmp/pp$$.lis' ;" echo "title Printing dataset: %nrbquote($dataset) Date: &sysdate. Time: &systime.;" echo "data $dataset; set sasdata.$dataset ;" if ("$2"!= '') then echo " where $condition;" echo "proc print data=$dataset;" echo "Running proc print on dataset: $dataset ($sasdir)" # Run the program in the temporary directory./tmp cd /tmp sas -913 pp$$.sas >> /tmp/pp$$.lis grep -i "sas stopped" /tmp/pp$$.log 2
3 test -f /tmp/pp$$.lis; set stat=$status if ($stat == 0) then set lines = `head -10 /tmp/pp$$.lis wc -l` if ($lines <= 2) then echo No output.lst file was created. more /tmp/pp$$.log more /tmp/pp$$.lis echo No output.lst file was created. more /tmp/pp$$.log /bin/rm -rf /tmp/pp$$.* B. SAS UNIX SCRIPT pf Command syntax: pf dataset tables condition This script pf (short for proc freq), which, when executed with parameters dataset, tables and condition, would be equivalent to the execution of the following PROC FREQ code in SAS: proc freq data=dataset; tables tables / missing missprint; where (condition); run; As an example, producing the frequency table race*sex from the demo.sas7bdat dataset for age group age > 50 would simply require the following command: pf demo race*sex age>50 which yields the following result: Figure 2. Results generated after executing pf example. The straightforward Unix script for pf would be: #!/bin/csh -f # pf performs PROC FREQ on SAS dataset 3
4 # The first argument is the dataset # The second argument is the tables statement # The third argument is the condition statement set dataset = "$1" set tables = "$2" set condition = "$3" # Find the dataset file set pwd=`pwd` if (-f $dataset.sas7bdat == 1) then set sasdir = "$pwd" echo "Dataset: $dataset.sas7bdat not found. Exiting... " # Begin constructing the SAS program in the temporary directory /tmp echo "%*include 'init.sas';" >! /tmp/pf$$.sas echo "libname sasdata '$sasdir';" # Continue constructing the program echo "options nocenter nofmterr pagesize=74 linesize=150;" echo "proc printto file='/tmp/pf$$.lis';" echo "proc freq data=sasdata.$dataset;" echo " tables $tables;" if ("$3"!= '') then echo " where $condition;" echo "Running proc freq on dataset: $dataset ($sasdir)" # Run the program in temporary directory cd /tmp sas -913 pf$$.sas >> pf$$.lis grep -i "sas stopped" /tmp/pf$$.log test -f /tmp/pf$$.lis; set stat=$status if ($stat == 0) then set lines = `head -10 /tmp/pf$$.lis wc -l` if ($lines <= 2) then echo empty.lis file created. more /tmp/pf$$.log more /tmp/pf$$.lis echo no.lis file created. more /tmp/pf$$.log /bin/rm -rf /tmp/pf$$.* C. SAS UNIX SCRIPT pu Command syntax: pu dataset variable condition byvar This script pu (short for proc univariate), which, when executed with parameters dataset, variable, condition and byvar, would be equivalent to the execution of the following PROC UNIVARIATE code in SAS: proc univariate data=dataset; var variable; where (condition); by byvar; run; As an example, producing the univariate statistics for variable age stratified by sex from the demo.sas7bdat dataset for condition (cohort = A1 ) would simply require the following command: pu demo age cohort= A1 sex which yields the following result: 4
5 Figure 3. Partial results generated after executing pu example. The straightforward Unix script for pu is as follows: #!/bin/csh -f # pu - performs PROC UNIVARIATE on specific continuous variable in SAS dataset # The first argument is the dataset # The second argument is the variable of interest # The third argument is the condition statement # The fourth argument is the BY variable to stratify analysis set dataset = "$1" set variable = "$2" set condition = "$3" set byvar = "$4" # Determine if edit is requested to edit/modify SAS job if ("$3" == 'edit' "$4" == 'edit' "$5" == 'edit') then set edit = yes set edit = no # Find the dataset file set pwd=`pwd` if (-f $dataset.sas7bdat == 1) then set sasdir = "$pwd" echo "Dataset: $dataset.sas7bdat not found. Exiting... " # Begin constructing the sas program in the temporary directory /tmp echo "%*include 'init.sas';" >! /tmp/pu$$.sas echo "libname sasdata '$sasdir';" >> /tmp/pu$$.sas 5
6 # Continue constructing the program echo "options nocenter nofmterr pagesize=74 linesize=90;" >> /tmp/pu$$.sas echo "proc printto file='/tmp/pu$$.lis';" >> /tmp/pu$$.sas >> /tmp/pu$$.sas echo "data $dataset;" >> /tmp/pu$$.sas echo " set sasdata.$dataset;" >> /tmp/pu$$.sas >> /tmp/pu$$.sas >> /tmp/pu$$.sas if ("$4"!= '' & "$4"!= 'edit') then echo "proc sort data= $dataset;" >> /tmp/pu$$.sas echo " by $byvar;" >> /tmp/pu$$.sas >> /tmp/pu$$.sas >> /tmp/pu$$.sas echo "proc univariate data=$dataset;" >> /tmp/pu$$.sas echo " var $variable;" >> /tmp/pu$$.sas if ("$3"!= '' & "$3"!= 'edit') then echo " where $condition;" >> /tmp/pu$$.sas if ("$4"!= '' & "$4"!= 'edit') then echo " by $byvar;" >> /tmp/pu$$.sas >> /tmp/pu$$.sas >> /tmp/pu$$.sas # If edit set to yes, then invoke the text editor if ("$edit" == 'yes') then vi /tmp/pu$$.sas echo "Running (edited) proc univariate on dataset: $dataset ($sasdir)" echo "Running proc univariate on dataset: $dataset ($sasdir)" # Run the program in the scratch directory cd /tmp sas -913 pu$$.sas >> pu$$.lis grep -i "sas stopped" /tmp/pu$$.log test -f /tmp/pu$$.lis; set stat=$status if ($stat == 0) then set lines = `head -10 /tmp/pu$$.lis wc -l` if ($lines <= 2) then echo No output.lst file was created. more /tmp/pu$$.log more /tmp/pu$$.lis echo No output.lst file was created. more /tmp/pu$$.log /bin/rm -rf /tmp/pu$$.* D. SAS UNIX SCRIPT pc Command syntax: pc dataset This script pc (short for proc contents), which, when executed with parameter dataset, would be equivalent to the execution of the following PROC CONTENTS code in SAS: proc contents data=dataset; run; As an example, producing the contents of the demo.sas7bdat dataset would simply require the following command: pc demo which yields the following result: 6
7 Figure 4. Results generated after executing pc demo. MODIFYING SAS UNIX SCRIPTS FOR ADDED ENHANCEMENTS Once a desired Unix script command is finalized, oftentimes the actual SAS command generated needs to be saved to be formalized as a library job. A possible enhancement would be the option to create and edit the SAS job prior to the script execution. This is accomplished by simply adding a parameter or option to the script, in the form of a unique parameter value that can only be interpreted for creating and editing such a SAS job. In our example, we use the keyword edit. When the keyword edit is parsed as an option, the temporary SAS job is opened in Unix window (using default editor) for editing and saving. A. SAS UNIX SCRIPT pu WITH edit PARAMETER Command syntax: pu dataset variable condition edit For the same SAS example for script pu above, the following job is created and opened in the default Unix editor when using edit option in the command line: pu demo age cohort= A1 sex edit 7
8 Figure 5. Sample code generated when using edit option with script pu. Once can save this temporary job in /tmp/ directory into an actual SAS job, to be formalized as a library job later. This file can be saved before the script actually executes the job and dumps the results into the default output, which was shown earlier. (Note that in the actual script, SAS statements to sort the dataset by the byvar variable have been added to avoid potential errors due to unsorted data.) B. SAS UNIX SCRIPT pc WITH edit PARAMETER Command syntax: pu dataset variable condition edit For the same SAS example for the script pc above, the following job is created and opened in the default Unix editor when using edit option in the command line: pc demo edit Figure 6. Code generated when using edit with script pc. CONCLUSION Creating Unix scripts to automate SAS execution is practical for teams with members that need quick access to SAS results without having to learn the necessary programming behind SAS. This saves valuable time and effort for the SAS programmer, who can then concentrate on planned deliverables instead of getting bogged down by ad hoc requests. The scripts also aid the programmer or study teams members to make quick exploratory data checks. For data checks and ad hoc requests that are often repeated as tedious tasks, the edit feature allows the programmer to save the job into a more formal SAS production job. 8
9 CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Raoul A. Bernal Amgen Inc. One Amgen Center Drive Thousand Oaks, CA Work Phone: Web: 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 trademarks of their respective companies. 9
SAS Display Manager Windows. For Windows
SAS Display Manager Windows For Windows Computers with SAS software SSCC Windows Terminal Servers (Winstat) Linux Servers (linstat) Lab computers DoIT Info Labs (as of June 2014) In all Labs with Windows
More informationUsing UNIX Shell Scripting to Enhance Your SAS Programming Experience
Using UNIX Shell Scripting to Enhance Your SAS Programming Experience By James Curley SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute
More informationCC13 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 informationQuality 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 informationSAS Training Spring 2006
SAS Training Spring 2006 Coxe/Maner/Aiken Introduction to SAS: This is what SAS looks like when you first open it: There is a Log window on top; this will let you know what SAS is doing and if SAS encountered
More informationPaper A Simplified and Efficient Way to Map Variable Attributes of a Clinical Data Warehouse
Paper 117-28 A Simplified and Efficient Way to Map Variable Attributes of a Clinical Data Warehouse Yanyun Shen, Genentech, Inc., South San Francisco ABSTRACT In the pharmaceutical industry, pooling a
More informationEasing into Data Exploration, Reporting, and Analytics Using SAS Enterprise Guide
Paper 809-2017 Easing into Data Exploration, Reporting, and Analytics Using SAS Enterprise Guide ABSTRACT Marje Fecht, Prowerk Consulting Whether you have been programming in SAS for years, are new to
More informationSAS Studio: A New Way to Program in SAS
SAS Studio: A New Way to Program in SAS Lora D Delwiche, Winters, CA Susan J Slaughter, Avocet Solutions, Davis, CA ABSTRACT SAS Studio is an important new interface for SAS, designed for both traditional
More informationSAS PROGRAMMING AND APPLICATIONS (STAT 5110/6110): FALL 2015 Module 2
SAS PROGRAMMING AND APPLICATIONS (STAT 5110/6110): FALL 2015 Department of MathemaGcs and StaGsGcs Phone: 4-3620 Office: Parker 364- A E- mail: carpedm@auburn.edu Web: hup://www.auburn.edu/~carpedm/stat6110
More informationCustomizing 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 informationRun 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 informationA Linux Shell Script to Automatically Compare Results of Statistical Analyses
PharmaSUG 2018 - Paper AD-04 A Linux Shell Script to Automatically Compare Results of Statistical Analyses Chen Wang, Shu Zan and Joshua Conrad, Gilead Sciences, Inc. Foster City, CA ABSTRACT Double programming
More informationEpidemiology Principles of Biostatistics Chapter 3. Introduction to SAS. John Koval
Epidemiology 9509 Principles of Biostatistics Chapter 3 John Koval Department of Epidemiology and Biostatistics University of Western Ontario What we will do today We will learn to use use SAS to 1. read
More informationSCSUG-2017 SAS Grid Job Search Performance Piyush Singh, Ghiyasuddin Mohammed Faraz Khan, Prasoon Sangwan TATA Consultancy Services Ltd.
SCSUG-2017 SAS Grid Job Search Performance Piyush Singh, Ghiyasuddin Mohammed Faraz Khan, Prasoon Sangwan TATA Consultancy Services Ltd. ABSTRACT Have you ever tried to find the job execution information
More informationHow Managers and Executives Can Leverage SAS Enterprise Guide
Paper 8820-2016 How Managers and Executives Can Leverage SAS Enterprise Guide ABSTRACT Steven First and Jennifer First-Kluge, Systems Seminar Consultants, Inc. SAS Enterprise Guide is an extremely valuable
More informationCS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater)
CS 3410 Intro to Unix, shell commands, etc... (slides from Hussam Abu-Libdeh and David Slater) 28 January 2013 Jason Yosinski Original slides available under Creative Commons Attribution-ShareAlike 3.0
More informationCSCI 211 UNIX Lab. Shell Programming. Dr. Jiang Li. Jiang Li, Ph.D. Department of Computer Science
CSCI 211 UNIX Lab Shell Programming Dr. Jiang Li Why Shell Scripting Saves a lot of typing A shell script can run many commands at once A shell script can repeatedly run commands Help avoid mistakes Once
More informationUsing UNIX Shell Scripting to Enhance Your SAS Programming Experience
Paper 2412-2018 Using UNIX Shell Scripting to Enhance Your SAS Programming Experience James Curley, Eliassen Group ABSTRACT This series will address three different approaches to using a combination of
More informationEssential Unix and Linux! Perl for Bioinformatics, ! F. Pineda
Essential Unix and Linux! Perl for Bioinformatics, 140.636! F. Pineda Generic computer architecture Memory Storage Fig. 1.2 From Designing Embedded Hardware, 2 nd Ed. by John Catsoulis OS concepts Shell
More informationOne Project, Two Teams: The Unblind Leading the Blind
ABSTRACT PharmaSUG 2017 - Paper BB01 One Project, Two Teams: The Unblind Leading the Blind Kristen Reece Harrington, Rho, Inc. In the pharmaceutical world, there are instances where multiple independent
More informationEXAMPLE 3: MATCHING DATA FROM RESPONDENTS AT 2 OR MORE WAVES (LONG FORMAT)
EXAMPLE 3: MATCHING DATA FROM RESPONDENTS AT 2 OR MORE WAVES (LONG FORMAT) DESCRIPTION: This example shows how to combine the data on respondents from the first two waves of Understanding Society into
More informationGoing Under the Hood: How Does the Macro Processor Really Work?
Going Under the Hood: How Does the Really Work? ABSTRACT Lisa Lyons, PPD, Inc Hamilton, NJ Did you ever wonder what really goes on behind the scenes of the macro processor, or how it works with other parts
More informationTopic 2: More Shell Skills
Topic 2: More Shell Skills Sub-topics: 1 quoting 2 shell variables 3 sub-shells 4 simple shell scripts (no ifs or loops yet) 5 bash initialization files 6 I/O redirection & pipes 7 aliases 8 text file
More informationEXAMPLE 2: INTRODUCTION TO SAS AND SOME NOTES ON HOUSEKEEPING PART II - MATCHING DATA FROM RESPONDENTS AT 2 WAVES INTO WIDE FORMAT
EXAMPLE 2: PART I - INTRODUCTION TO SAS AND SOME NOTES ON HOUSEKEEPING PART II - MATCHING DATA FROM RESPONDENTS AT 2 WAVES INTO WIDE FORMAT USING THESE WORKSHEETS For each of the worksheets you have a
More informationA 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 informationWhy SAS Programmers Should Learn Python Too
PharmaSUG 2018 - Paper AD-12 ABSTRACT Why SAS Programmers Should Learn Python Too Michael Stackhouse, Covance, Inc. Day to day work can often require simple, yet repetitive tasks. All companies have tedious
More information1. What statistic did the wc -l command show? (do man wc to get the answer) A. The number of bytes B. The number of lines C. The number of words
More Linux Commands 1 wc The Linux command for acquiring size statistics on a file is wc. This command provides the line count, word count and number of bytes in a file. Open up a terminal, make sure you
More informationThen, we modify the program list.1 to list two files.
ACS-2941-001 Unix (Winter Term, 2016-17) Part II: Shell Programming Page 17 Working with Parameters A Unix shell allows users to pass parameters to shell scripts. With processing the parameters passed
More informationPerl and R Scripting for Biologists
Perl and R Scripting for Biologists Lukas Mueller PLBR 4092 Course overview Linux basics (today) Linux advanced (Aure, next week) Why Linux? Free open source operating system based on UNIX specifications
More informationSAS Macros of Performing Look-Ahead and Look-Back Reads
PharmaSUG 2018 - Paper QT-05 ABSTRACT SAS Macros of Performing Look-Ahead and Look-Back Reads Yanhong Liu, Cincinnati Children s Hospital Medical Center, Cincinnati, OH When working with the time series
More informationEssentials for Scientific Computing: Bash Shell Scripting Day 3
Essentials for Scientific Computing: Bash Shell Scripting Day 3 Ershaad Ahamed TUE-CMS, JNCASR May 2012 1 Introduction In the previous sessions, you have been using basic commands in the shell. The bash
More informationReport Writing, SAS/GRAPH Creation, and Output Verification using SAS/ASSIST Matthew J. Becker, ST TPROBE, inc., Ann Arbor, MI
Report Writing, SAS/GRAPH Creation, and Output Verification using SAS/ASSIST Matthew J. Becker, ST TPROBE, inc., Ann Arbor, MI Abstract Since the release of SAS/ASSIST, SAS has given users more flexibility
More informationPharmaSUG Paper PO10
PharmaSUG 2013 - Paper PO10 How to make SAS Drug Development more efficient Xiaopeng Li, Celerion Inc., Lincoln, NE Chun Feng, Celerion Inc., Lincoln, NE Peng Chai, Celerion Inc., Lincoln, NE ABSTRACT
More informationUNIX Essentials Featuring Solaris 10 Op System
A Active Window... 7:11 Application Development Tools... 7:7 Application Manager... 7:4 Architectures - Supported - UNIX... 1:13 Arithmetic Expansion... 9:10 B Background Processing... 3:14 Background
More informationTopic 2: More Shell Skills. Sub-Topic 1: Quoting. Sub-Topic 2: Shell Variables. Difference Between Single & Double Quotes
Topic 2: More Shell Skills Sub-Topic 1: Quoting Sub-topics: 1 quoting 2 shell variables 3 sub-shells 4 simple shell scripts (no ifs or loops yet) 5 bash initialization files 6 I/O redirection & pipes 7
More informationStatistics, Data Analysis & Econometrics
ST009 PROC MI as the Basis for a Macro for the Study of Patterns of Missing Data Carl E. Pierchala, National Highway Traffic Safety Administration, Washington ABSTRACT The study of missing data patterns
More informationCan you decipher the code? If you can, maybe you can break it. Jay Iyengar, Data Systems Consultants LLC, Oak Brook, IL
Paper 11667-2016 Can you decipher the code? If you can, maybe you can break it. Jay Iyengar, Data Systems Consultants LLC, Oak Brook, IL ABSTRACT You would think that training as a code breaker, similar
More informationA Cross-national Comparison Using Stacked Data
A Cross-national Comparison Using Stacked Data Goal In this exercise, we combine household- and person-level files across countries to run a regression estimating the usual hours of the working-aged civilian
More informationLST in Comparison Sanket Kale, Parexel International Inc., Durham, NC Sajin Johnny, Parexel International Inc., Durham, NC
ABSTRACT PharmaSUG 2013 - Paper PO01 LST in Comparison Sanket Kale, Parexel International Inc., Durham, NC Sajin Johnny, Parexel International Inc., Durham, NC The need for producing error free programming
More information3. 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 informationCopy That! Using SAS to Create Directories and Duplicate Files
Copy That! Using SAS to Create Directories and Duplicate Files, SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and
More informationSub-Topic 1: Quoting. Topic 2: More Shell Skills. Sub-Topic 2: Shell Variables. Referring to Shell Variables: More
Topic 2: More Shell Skills Plan: about 3 lectures on this topic Sub-topics: 1 quoting 2 shell variables 3 sub-shells 4 simple shell scripts (no ifs or loops yet) 5 bash initialization files 6 I/O redirection
More informationChapter-3. Introduction to Unix: Fundamental Commands
Chapter-3 Introduction to Unix: Fundamental Commands What You Will Learn The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system
More informationEssential 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%MAKE_IT_COUNT: An Example Macro for Dynamic Table Programming Britney Gilbert, Juniper Tree Consulting, Porter, Oklahoma
Britney Gilbert, Juniper Tree Consulting, Porter, Oklahoma ABSTRACT Today there is more pressure on programmers to deliver summary outputs faster without sacrificing quality. By using just a few programming
More informationThe Submission Data File System Automating the Creation of CDISC SDTM and ADaM Datasets
Paper AD-08 The Submission Data File System Automating the Creation of CDISC SDTM and ADaM Datasets Marcus Bloom, Amgen Inc, Thousand Oaks, CA David Edwards, Amgen Inc, Thousand Oaks, CA ABSTRACT From
More informationGetting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA
SESUG 2012 Paper HW-01 Getting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA ABSTRACT Learning the basics of PROC REPORT can help the new SAS user avoid hours of headaches.
More informationText Generational Data Sets (Text GDS)
Paper 274-2017 Text Generational Data Sets (Text GDS) Dr. Kannan Deivasigamani HSBC ABSTRACT This paper offers a way to fill the void that SAS currently has with respect to the missing feature in the language,
More informationPharmaSUG Paper AD06
PharmaSUG 2012 - Paper AD06 A SAS Tool to Allocate and Randomize Samples to Illumina Microarray Chips Huanying Qin, Baylor Institute of Immunology Research, Dallas, TX Greg Stanek, STEEEP Analytics, Baylor
More informationEfficiently 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 informationPaper CC16. William E Benjamin Jr, Owl Computer Consultancy LLC, Phoenix, AZ
Paper CC16 Smoke and Mirrors!!! Come See How the _INFILE_ Automatic Variable and SHAREBUFFERS Infile Option Can Speed Up Your Flat File Text-Processing Throughput Speed William E Benjamin Jr, Owl Computer
More informationCS 4218 Software Testing and Debugging Ack: Tan Shin Hwei for project description formulation
CS 4218 Software Testing and Debugging Ack: Tan Shin Hwei for project description formulation The Project CS 4218 covers the concepts and practices of software testing and debugging. An important portion
More informationBash command shell language interpreter
Principles of Programming Languages Bash command shell language interpreter Advanced seminar topic Louis Sugy & Baptiste Thémine Presentation on December 8th, 2017 Table of contents I. General information
More informationUsing SAS Macros to Extract P-values from PROC FREQ
SESUG 2016 ABSTRACT Paper CC-232 Using SAS Macros to Extract P-values from PROC FREQ Rachel Straney, University of Central Florida This paper shows how to leverage the SAS Macro Facility with PROC FREQ
More informationGet 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 informationUsing a Fillable PDF together with SAS for Questionnaire Data Donald Evans, US Department of the Treasury
Using a Fillable PDF together with SAS for Questionnaire Data Donald Evans, US Department of the Treasury Introduction The objective of this paper is to demonstrate how to use a fillable PDF to collect
More informationA Guided Tour Through the SAS Windowing Environment Casey Cantrell, Clarion Consulting, Los Angeles, CA
A Guided Tour Through the SAS Windowing Environment Casey Cantrell, Clarion Consulting, Los Angeles, CA ABSTRACT The SAS system running in the Microsoft Windows environment contains a multitude of tools
More informationIntroduction to SAS. Cristina Murray-Krezan Research Assistant Professor of Internal Medicine Biostatistician, CTSC
Introduction to SAS Cristina Murray-Krezan Research Assistant Professor of Internal Medicine Biostatistician, CTSC cmurray-krezan@salud.unm.edu 20 August 2018 What is SAS? Statistical Analysis System,
More informationPaper ###-YYYY. SAS Enterprise Guide: A Revolutionary Tool! Jennifer First, Systems Seminar Consultants, Madison, WI
Paper ###-YYYY SAS Enterprise Guide: A Revolutionary Tool! Jennifer First, Systems Seminar Consultants, Madison, WI ABSTRACT Whether you are a novice or a pro with SAS, Enterprise Guide has something for
More informationAn Annotated Guide: The New 9.1, Free & Fast SPDE Data Engine Russ Lavery, Ardmore PA, Independent Contractor Ian Whitlock, Kennett Square PA
An Annotated Guide: The New 9.1, Free & Fast SPDE Data Engine Russ Lavery, Ardmore PA, Independent Contractor Ian Whitlock, Kennett Square PA ABSTRACT SAS has been working hard to decrease clock time to
More informationIntroduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines
Introduction to UNIX Logging in Basic system architecture Getting help Intro to shell (tcsh) Basic UNIX File Maintenance Intro to emacs I/O Redirection Shell scripts Logging in most systems have graphical
More informationEssential Skills for Bioinformatics: Unix/Linux
Essential Skills for Bioinformatics: Unix/Linux SHELL SCRIPTING Overview Bash, the shell we have used interactively in this course, is a full-fledged scripting language. Unlike Python, Bash is not a general-purpose
More informationStatements with the Same Function in Multiple Procedures
67 CHAPTER 3 Statements with the Same Function in Multiple Procedures Overview 67 Statements 68 BY 68 FREQ 70 QUIT 72 WEIGHT 73 WHERE 77 Overview Several statements are available and have the same function
More informationA Few Quick and Efficient Ways to Compare Data
A Few Quick and Efficient Ways to Compare Data Abraham Pulavarti, ICON Clinical Research, North Wales, PA ABSTRACT In the fast paced environment of a clinical research organization, a SAS programmer has
More informationSESUG 2014 IT-82 SAS-Enterprise Guide for Institutional Research and Other Data Scientists Claudia W. McCann, East Carolina University.
Abstract Data requests can range from on-the-fly, need it yesterday, to extended projects taking several weeks or months to complete. Often institutional researchers and other data scientists are juggling
More informationIntermediate SAS: Working with Data
Intermediate SAS: Working with Data OIT Technical Support Services 293-4444 oithelp@mail.wvu.edu oit.wvu.edu/training/classmat/sas/ Table of Contents Getting set up for the Intermediate SAS workshop:...
More informationUsing PROC SQL to Calculate FIRSTOBS David C. Tabano, Kaiser Permanente, Denver, CO
Using PROC SQL to Calculate FIRSTOBS David C. Tabano, Kaiser Permanente, Denver, CO ABSTRACT The power of SAS programming can at times be greatly improved using PROC SQL statements for formatting and manipulating
More informationCS 307: UNIX PROGRAMMING ENVIRONMENT FIND COMMAND
CS 307: UNIX PROGRAMMING ENVIRONMENT FIND COMMAND Prof. Michael J. Reale Fall 2014 Finding Files in a Directory Tree Suppose you want to find a file with a certain filename (or with a filename matching
More informationShell scripting and system variables. HORT Lecture 5 Instructor: Kranthi Varala
Shell scripting and system variables HORT 59000 Lecture 5 Instructor: Kranthi Varala Text editors Programs built to assist creation and manipulation of text files, typically scripts. nano : easy-to-learn,
More informationABSTRACT DATA CLARIFCIATION FORM TRACKING ORACLE TABLE INTRODUCTION REVIEW QUALITY CHECKS
Efficient SAS Quality Checks: Unique Error Identification And Enhanced Data Management Analysis Jim Grudzinski, Biostatistics Manager Of SAS Programming Covance Periapproval Services Inc, Radnor, PA ABSTRACT
More informationSet 1 MCQ Which command is used to sort the lines of data in a file in reverse order A) sort B) sh C) st D) sort -r
1. Which symbol will be used with grep command to match the pattern pat at the beginning of a line? A) ^pat B) $pat C) pat$ D) pat^ 2. Which command is used to sort the lines of data in a file in reverse
More informationSAS/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 informationCMISS the SAS Function You May Have Been MISSING Mira Shapiro, Analytic Designers LLC, Bethesda, MD
ABSTRACT SESUG 2016 - RV-201 CMISS the SAS Function You May Have Been MISSING Mira Shapiro, Analytic Designers LLC, Bethesda, MD Those of us who have been using SAS for more than a few years often rely
More informationIntroduction to the UNIX command line
Introduction to the UNIX command line Steven Abreu Introduction to Computer Science (ICS) Tutorial Jacobs University s.abreu@jacobs-university.de September 19, 2017 Overview What is UNIX? UNIX Shell Commands
More informationKeeping Track of Database Changes During Database Lock
Paper CC10 Keeping Track of Database Changes During Database Lock Sanjiv Ramalingam, Biogen Inc., Cambridge, USA ABSTRACT Higher frequency of data transfers combined with greater likelihood of changes
More informationStat Wk 3. Stat 342 Notes. Week 3, Page 1 / 71
Stat 342 - Wk 3 What is SQL Proc SQL 'Select' command and 'from' clause 'group by' clause 'order by' clause 'where' clause 'create table' command 'inner join' (as time permits) Stat 342 Notes. Week 3,
More informationPermission Program. Support for Version 6 Only. Allowing SAS/SHARE Client Access to SAS Libraries or Files CHAPTER 40
499 CHAPTER 40 Permission Program Support for Version 6 Only 499 Allowing SAS/SHARE Client Access to SAS Libraries or Files 499 Permission Program Examples 500 Building the Permission Program 500 Testing
More informationPatricia Guldin, Merck & Co., Inc., Kenilworth, NJ USA
SESUG 2015 Paper AD-35 Programming Compliance Made Easy with a Time Saving Toolbox Patricia Guldin, Merck & Co., Inc., Kenilworth, NJ USA ABSTRACT Programmers perform validation in accordance with established
More informationBash Programming. Student Workbook
Student Workbook Bash Programming Published by ITCourseware, LLC, 7245 South Havana Street, Suite 100, Englewood, CO 80112 Contributing Authors: Julie Johnson, Rob Roselius Editor: Jeff Howell Special
More informationRouting Output. Producing Output with SAS Software CHAPTER 6
125 CHAPTER 6 Routing Output Producing Output with SAS Software 125 The Default Routings for the SAS Log and Procedure Output 126 Changing the Default Routings 127 Using the Print Dialog Box 128 Printing
More informationWorking with Big Data in SAS
ABSTRACT Paper SAS2160-2018 Working with Big Data in SAS Mark L. Jordan, SAS Institute Inc. This paper demonstrates challenges and solutions when using SAS to process large data sets. Learn how to do the
More informationIntroduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University
Introduction to Linux Woo-Yeong Jeong (wooyeong@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating system of a computer What is an
More informationIntroduction to Linux
Introduction to Linux Prof. Jin-Soo Kim( jinsookim@skku.edu) TA - Kisik Jeong (kisik@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating
More informationWhen talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:
Linux Tutorial How to read the examples When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used: $ application file.txt
More informationWhile You Were Sleeping, SAS Was Hard At Work Andrea Wainwright-Zimmerman, Capital One Financial, Inc., Richmond, VA
Paper BB-02 While You Were Sleeping, SAS Was Hard At Work Andrea Wainwright-Zimmerman, Capital One Financial, Inc., Richmond, VA ABSTRACT Automating and scheduling SAS code to run over night has many advantages,
More informationWhat Do You Mean My CSV Doesn t Match My SAS Dataset?
SESUG 2016 Paper CC-132 What Do You Mean My CSV Doesn t Match My SAS Dataset? Patricia Guldin, Merck & Co., Inc; Young Zhuge, Merck & Co., Inc. ABSTRACT Statistical programmers are responsible for delivering
More informationCS214 Advanced UNIX Lecture 4
CS214 Advanced UNIX Lecture 4 March 2, 2005 Passing arguments to scripts When you invoke a command like > cat f1 f2 f3 f1, f2, f3 are all arguments you pass to the cat command. Many times in your script
More informationPROGRAMMING PROJECT ONE DEVELOPING A SHELL
PROGRAMMING PROJECT ONE DEVELOPING A SHELL William Stallings Copyright 2011 Supplement to Operating Systems, Seventh Edition Prentice Hall 2011 ISBN: 013230998X http://williamstallings.com/os/os7e.html
More informationPros and Cons of Interactive SAS Mode vs. Batch Mode Irina Walsh, ClinOps, LLC, San Francisco, CA
Pros and Cons of Interactive SAS Mode vs. Batch Mode Irina Walsh, ClinOps, LLC, San Francisco, CA ABSTRACT It is my opinion that SAS programs can be developed in either interactive or batch mode and produce
More informationPharmaSUG China Mina Chen, Roche (China) Holding Ltd.
PharmaSUG China 2017-50 Writing Efficient Queries in SAS Using PROC SQL with Teradata Mina Chen, Roche (China) Holding Ltd. ABSTRACT The emergence of big data, as well as advancements in data science approaches
More informationM2PGER FORTRAN programming. General introduction. Virginie DURAND and Jean VIRIEUX 10/13/2013 M2PGER - ALGORITHME SCIENTIFIQUE
M2PGER 2013-2014 FORTRAN programming General introduction Virginie DURAND and Jean VIRIEUX 1 Why learning programming??? 2 Why learning programming??? ACQUISITION numerical Recording on magnetic supports
More informationCleaning Duplicate Observations on a Chessboard of Missing Values Mayrita Vitvitska, ClinOps, LLC, San Francisco, CA
Cleaning Duplicate Observations on a Chessboard of Missing Values Mayrita Vitvitska, ClinOps, LLC, San Francisco, CA ABSTRACT Removing duplicate observations from a data set is not as easy as it might
More informationCreating a Shell or Command Interperter Program CSCI411 Lab
Creating a Shell or Command Interperter Program CSCI411 Lab Adapted from Linux Kernel Projects by Gary Nutt and Operating Systems by Tannenbaum Exercise Goal: You will learn how to write a LINUX shell
More informationAdvanced Unix Programming Module 03 Raju Alluri spurthi.com
Advanced Unix Programming Module 03 Raju Alluri askraju @ spurthi.com Advanced Unix Programming: Module 3 Shells & Shell Programming Environment Variables Writing Simple Shell Programs (shell scripts)
More informationUseful Tips When Deploying SAS Code in a Production Environment
Paper SAS258-2014 Useful Tips When Deploying SAS Code in a Production Environment ABSTRACT Elena Shtern, SAS Institute Inc., Arlington, VA When deploying SAS code into a production environment, a programmer
More informationThe DATA Statement: Efficiency Techniques
The DATA Statement: Efficiency Techniques S. David Riba, JADE Tech, Inc., Clearwater, FL ABSTRACT One of those SAS statements that everyone learns in the first day of class, the DATA statement rarely gets
More informationPAPER CC02 Link the Unlinked : Documenting Dependencies Among SAS Programs in a Project Abstract within across related Context and Clarification
PAPER CC02 Link the Unlinked : Documenting Dependencies Among SAS Programs in a Project Gopal Rajagopal, Merck Research Laboratories, Upper Gwynedd PA Abstract Agency submissions typically involve dozens
More informationRouting the SAS Log and SAS Procedure Output
187 CHAPTER 8 Routing the SAS Log and SAS Procedure Output Introduction 187 Attributes of the SAS Log and Procedure Output Files 188 Controlling Log and Output Destinations 188 Windowing Environment Mode
More informationDitch the Data Memo: Using Macro Variables and Outer Union Corresponding in PROC SQL to Create Data Set Summary Tables Andrea Shane MDRC, Oakland, CA
ABSTRACT Ditch the Data Memo: Using Macro Variables and Outer Union Corresponding in PROC SQL to Create Data Set Summary Tables Andrea Shane MDRC, Oakland, CA Data set documentation is essential to good
More informationPharmaSUG Paper IB11
PharmaSUG 2015 - Paper IB11 Proc Compare: Wonderful Procedure! Anusuiya Ghanghas, inventiv International Pharma Services Pvt Ltd, Pune, India Rajinder Kumar, inventiv International Pharma Services Pvt
More information