190 likes | 198 Views
How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004. Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts Merck & Company. Introduction. It’s easy to customize your PC SAS session!
E N D
How to Quickly Customize your PC SAS SessionPhilaSUGGSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts Merck & Company
Introduction • It’s easy to customize your PC SAS session! • With a “double click” of a Windows desktop shortcut you can launch PC SAS and automatically assign customized SAS settings.
Who can Benefit? • Any PC SAS user • Works for Versions 6.x, 7.x, 8.x, or 9.x although some parts of the shortcut are version dependent • You and members of your project team
What does the shortcut do? • Windows desktop shortcut that: • Launches SAS • Executes a user defined startup SAS program • Sets system options, macro variables, and library definitions and/or executes SAS code/macros in an automatic and reusable way • Defines a default startup location for Opening and Saving SAS files
When / Where / How… • When: The shortcut is used every time you want to launch SAS • Where: The shortcut is created once and saved to your desktop • How: Double-Click on the shortcut
Why • To save time • To ensure consistency • To share option settings, macro variables, macro code among project team members
Steps to Follow STEP 2: Create your STARTUP.SAS program STEP 1:Create the Windows Desktop Shortcut STEP 3: Double Click the Shortcut to Launch SAS Note: Steps 1 & 2 are interchangeable
STEP 1: Create Desktop Shortcut Right click on any open space on your desktop SelectNew Shortcut from the Menu Enter the Shortcut Location: c:\Documents and Settings\your_name_here\Desktop SelectNext
STEP 1: Create Desktop Shortcut Enter the Shortcut name: SAS Startup Project ABC SelectFinish
Customize the Shortcut - Target Right click the shortcut “SAS Startup Project ABC” SelectProperties from the Menu Next, Select the Shortcut tab Enter Target: <Syntax> “location of SAS on your PC” –autoexec “location of your startup.sas program” -SASinitialfolder “default location for SAS programs” <Example> "C:\Program Files\SAS Institute\SAS\V8\sas.exe" -autoexec"c:\DrugABC\prot001\utility\startup.sas“ -SASinitialfolder"C:\DrugABC\Prot001\pgm_analysis"
Customize the Shortcut – Start In (Continued) “Start In” defines the default location for the SAS editor to locate your program files (SAS V6.x and V7.x only) . Enter Start in: <Example> “C:\DrugABC\Prot001\pgm_analysis”Click Apply For SAS V8.x or higher, Use the -SASinitialfolder syntax on the Target field instead. Change Icon if desired
STEP 2: Create Startup.SAS • Create Global macro variables to define input directories for your SAS programs:%let drive = c:;%let protpath = &drive\DrugABC\Prot001; • Create Global macros variables to further define file locations by file type:%let datadir = &protpath\data_analysis;%let rawdir = &protpath\data_raw; • Create Global macro variables to further define macro libraries:%let macdir = &protpath\macrolib;
STEP 2: Create Startup.SAS(Continued) • Create Global macro variables to define output directories for LOG, LIS, tabular or graphical outputs from your SAS programs:%let logdir = &protpath\out_logs; %let listdir = &protpath\out_listings; %let graphdir = &protpath\out_graphics; %let tabledir = &protpath\out_tables; • Create Global macro variables to define SAS program locations:%let pgmdir = &protpath\pgm_analysis; %let setupdir = &protpath\pgm_setup; • Create library references to be used in your SAS programs:libname datadir "&datadir"; libname rawdir "&rawdir";
STEP 2: Create Startup.SAS(Continued) • Define options with the SAS OPTIONS command to customize your SAS Session:option mautosource mstored noxwait xsync nomprint pageno=1 sasautos=("&macdir" "&smacdir" "q:\maclib" sasautos); • Make macro calls to eliminate the need to call them in each program:* Call macro rtfsymbl and generate reference macro dagger_; %rtfsymbl(groups=Referenc); • Define frequently used formats:Proc Format; value riskfmt . = 'missing‘ -99 = 'undefined‘ 0.5 = '<1‘ 30 = '>=30';
STEP 2: Create Startup.SAS(Continued) • Define project specific macro variables:%let last_vst=8; *** last visit number for treatment phase ***; %let trtweek=%str(1 2 3 4 5); *** treatment weeks ***; %let __pvalue=0.05; *** p-value of signifiant ***; • Embed macro code:%macro mwkdef; select; when (.<rel_dy<=-1 and phase='Pre-Study') week= -1; when ((. < rel_dy <=1) and phase='Washout') week= 0 ; when ((2<= rel_dy <= 11) and phase in ('Treatment' 'Post-Study')) week= 1 ; when ((12<= rel_dy <= 21) and phase in ('Treatment' 'Post-Study')) week= 2 ; otherwise; end; %mend mwkdef;
STEP 3: Execute the Shortcut • Double-Click on yourSAS Startup Project ABC Shortcut.
STEP 3: Execute the Shortcut(Continued) • Click on file….open…..
Advice on Utilizing the Shortcut • Save your STARTUP.SAS program on a share drive. All team members can share and utilize the same shortcuts and settings • Create multiple shortcuts on your desktop for example:- development, test, or production versions of code- version for each of your current projects
In Recognition • Thank you to Margaret Coughlin, Donna Usavage and Ellen Asam for their expert guidance. • Q U E S T I O N S ….kathy_harkins@merck.commary_anne_rutkowski@merck.com