19
1 How to Quickly How to Quickly Customize your PC SAS Customize your PC SAS Session Session PhilaSUG PhilaSUG GSK GSK October 27, 2004 October 27, 2004 Mary Anne Rutkowski Mary Anne Rutkowski Kathy Harkins Kathy Harkins Senior Statistical Programming Analysts Senior Statistical Programming Analysts Merck & Company Merck & Company

1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

Embed Size (px)

Citation preview

Page 1: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

11

How to Quickly Customize How to Quickly Customize your PC SAS Sessionyour PC SAS Session

PhilaSUGPhilaSUGGSKGSK

October 27, 2004 October 27, 2004

Mary Anne RutkowskiMary Anne Rutkowski

Kathy HarkinsKathy Harkins

Senior Statistical Programming AnalystsSenior Statistical Programming Analysts

Merck & CompanyMerck & Company

Page 2: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

22

IntroductionIntroduction

• 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.

Page 3: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

33

Who can Benefit?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

Page 4: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

44

What does the shortcut do?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

Page 5: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

55

When / Where / How…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

Page 6: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

66

WhyWhy

• To save time

• To ensure consistency

• To share option settings, macro variables, macro code among project team members

Page 7: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

77

Steps to FollowSteps to Follow

STEP 1:Create the Windows Desktop Shortcut

STEP 2:Create your STARTUP.SAS program

STEP 3:Double Click the Shortcut to Launch SAS

Note: Steps 1 & 2 are interchangeable

Page 8: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

88

STEP 1: Create Desktop ShortcutSTEP 1: Create Desktop Shortcut

Right click on any open space on your desktop

Select New Shortcut from the Menu

Enter the Shortcut Location: c:\Documents and Settings\your_name_here\Desktop

Select Next

Page 9: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

99

STEP 1: Create Desktop ShortcutSTEP 1: Create Desktop Shortcut

Enter the Shortcut name:SAS Startup Project ABC

Select Finish

Page 10: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

1010

Customize the Shortcut - TargetCustomize the Shortcut - Target

Right click the shortcut “SAS Startup Project ABC”

Select Properties 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"

Page 11: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

1111

Customize the Shortcut – Start In Customize the Shortcut – Start In (Continued)(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

Page 12: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

1212

STEP 2: Create Startup.SASSTEP 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;

Page 13: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

1313

STEP 2: Create Startup.SASSTEP 2: Create Startup.SAS(Continued)(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";

Page 14: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

1414

STEP 2: Create Startup.SASSTEP 2: Create Startup.SAS(Continued)(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';

Page 15: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

1515

STEP 2: Create Startup.SASSTEP 2: Create Startup.SAS(Continued)(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;

Page 16: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

1616

STEP 3: Execute the ShortcutSTEP 3: Execute the Shortcut

• Double-Click on your SAS Startup Project ABC Shortcut.

Page 17: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

1717

STEP 3: Execute the ShortcutSTEP 3: Execute the Shortcut (Continued)(Continued)

• Click on file….open…..

Page 18: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

1818

Advice on Utilizing the ShortcutAdvice 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

Page 19: 1 How to Quickly Customize your PC SAS Session PhilaSUG GSK October 27, 2004 Mary Anne Rutkowski Kathy Harkins Senior Statistical Programming Analysts

1919

In Recognition 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 …[email protected][email protected]