Page 2 of 13. Lecture 4. ⢠REFERENCING EXTERNAL FILES. ⢠ODS. ⢠LAG & RETAIN. ⢠ARRAYS. ⢠SAS GRAPH. â¢MA
Data Processing with PC-‐SAS PubH 6325
J. Michael Oakes, PhD
Associate Professor Division of Epidemiology University of Minnesota
[email protected]
Lecture 4/4
Lecture 4
• REFERENCING EXTERNAL FILES • ODS • LAG & RETAIN • ARRAYS • SAS GRAPH • MACROS • STATA
Referencing External Files Indirectly -‐ If you want to reference a file in only one place in a program so that you can easily change it for another job or a later run use a FILENAME statement filename mydata ‘c:\temp\data.txt‘ filename myprog ‘c:\temp\prog.txt‘ data weight; infile mydata; input idno $ week1 week16; loss=week1-‐week16; %include myprog;
Referencing External Files Directly -‐ data weight; infile ‘c:\temp\data.txt‘ ; input idno $ week1 week16; loss=week1-‐week16; %include ‘c:\temp\prog.txt‘ ;
ODS The Output Delivery System (ODS) is a new “module” in SAS v8. It permits fancy output to be “printed” to the output window, or results (eg, stagsgcs) to be output into a SAS dataset. ODS yields three types of fancy output: HTML RTF SAS data
RETAIN Doing calculagons within an observagon (ie, subject) is relagvely easy. Calculagons between observagons is more challenging! How many days since last visit for each pagent in clinical data set. Retain lag first.varname last.varname
Arrays Arrays permit you to do stuff to a bunch of variables at the same gme. Once you define an array you can refer to the array itself, which stands for the variable list inside.
SAS Graphs Helpful, but also consider other programs. See Dr. Kleinman’s tutorial program
Macros Fundamentally, macros are “tools” for text subsgtugon.
Macros help: Accomplish repeggve tasks quickly and efficiently. Provide modular structure to your program.
Macros Macro language statements begin with a % Macro variables start with a &
Inigalize macro, then run as you wish.
Stata Like SAS, but arguably bener:
• Certainly easier to learn • Far Less expensive • Much bener Help files • Acgve Listserve community • Super graphics
My “Stata” Course PubH6617
Pracgcal Methods for Secondary Data Analysis Fall Term: TuTh 8:30 am – 9:15 am
Lab #4
FINAL EXAM