140 likes | 269 Views
A Useful Footnote Martha Cox Population Health Research Unit Community Health & Epidemiology Dalhousie University. Make the output tell you where it came from. Program Name Date and time it was submitted Who ran it. Program Name.
E N D
A Useful FootnoteMartha CoxPopulation Health Research UnitCommunity Health & EpidemiologyDalhousie University
Make the output tell you where it came from • Program Name • Date and time it was submitted • Who ran it
Program Name • SAS system option SYSINSpecifies the default location of SAS source programs • SAS function GETOPTIONReturns the current value of the specified system or graphics option getoption(sysin) → full operating system path & filename
%SYSFUNC a way to execute a data step function without being in a data step If the result might contain special characters or mnemonic operators, use %QSYSFUNC instead.
Program Name %qsysfunc(getoption(SYSIN))
Automatic Macro Variables &sysdate 19OCT07 &sysdate9 19OCT2007 &systime 16:22 &sysuserid MCOX &sysvlong 8.02.02M0P012301
Date Submitted %sysfunc(today(), yymmddD10.)
Who Ran The Program SAS Automatic Macro Variable: &sysuserid This variable has a length of 12. "MCOX " So to use it in a sentence, we need to trim it.
Who Ran The Program %sysfunc(trim(&sysuserid))
proc freq data=shrug.sample; tables sex; footnote1 "Program: %qsysfunc(getoption(SYSIN)) submitted %sysfunc(today(), yymmddD10.) at &systime. by %sysfunc(trim(&sysuserid))."; run; Putting it all together
The FREQ Procedure Patient Gender Cumulative Cumulative sex Frequency Percent Frequency Percent -------------------------------------------------------- F 4 40.00 4 40.00 M 6 60.00 10 100.00 Program: DISK$USER1:[MCOX.SHRUG]FOOTVMS.SAS;21 submitted 2007-10-12 at 17:42 by MCOX. The Results (VMS batch job)
Notes about Display Manager • SYSIN is blank • &systime = the time you started your SAS session; not when that bit of code was run • &sysuserid = the 'registered' PC user(See Control Panel → System.)