Presentation is loading. Please wait.

Presentation is loading. Please wait.

01/20151 EPI 5344: Survival Analysis in Epidemiology SAS code and output February 24, 2015 Dr. N. Birkett, School of Epidemiology, Public Health & Preventive.

Similar presentations


Presentation on theme: "01/20151 EPI 5344: Survival Analysis in Epidemiology SAS code and output February 24, 2015 Dr. N. Birkett, School of Epidemiology, Public Health & Preventive."— Presentation transcript:

1 01/20151 EPI 5344: Survival Analysis in Epidemiology SAS code and output February 24, 2015 Dr. N. Birkett, School of Epidemiology, Public Health & Preventive Medicine, University of Ottawa

2 SAS Output Delivery System (ODS) Default method for getting output from SAS procedures Can produce: –printed results –graphics (hi-res) –Data tables for use in future procs 01/20152

3 SAS Output Delivery System (ODS) Output formats include: –HTML –RTF –PDF Provides extensive control of output format, colors, etc. –1500 page ‘basic manual’. –more manuals for graphics 01/20153

4 SAS Output Delivery System (ODS) Basic use is relatively simple –80/20 rule –add on features as you get better at it By default, ALL SAS output is prepared as HTML –Presented in the Results Window 01/20154

5 5 ODS produces output which has two components

6 01/20156 To change type of output: ODS HTML close; ODS PDF; To save output to a file: ODS HTML file = ‘file_name.html’; -Can define the filename in a ‘filename’ statement and put the reference here: filename f1 ‘C:/home/EPI5344.html’; ODS HTML file=f1;

7 01/20157 To change the style of output: ODS HTML style=beige; When ready to actually save your output file, place this statement at the end of your code: ODS HTML close; Place an ‘ODS HTML’ at the start of your file to re-open output stream.

8 ODS pdf style=Normal 01/20158 ODS pdf style=Torn ODS pdf style=Journal

9 01/20159 HTML Output

10 01/201510 RTF Output - displayed in Word

11 01/201511 PDF Output

12 01/201512 Graphics example

13 01/201513 Graphics example

14 Some ODS code ODS HTML file ‘C:/mysas.html’; ods pdf file=‘C:/mysas.pdf’; ods rtf file=‘C:/mysas.rtf’; ods ps file=‘C:/mysas.ps’; proc print data=employee_data (obs=12); id idnumber; title ‘Personnel data’; run; ods _all_ close; ods listing; 01/201514

15 2 other ODS commands Get a list of the tables created by a Proc. Use to link data into subsequent Procs. Result is placed in ‘LOG FILE’. ODS trace on; proc freq data=t1; run; ODS trace off; 01/201515

16 2280 ods trace on; 2281 proc lifetest data=njb1; 2282 time ftime*vstatus(0); 2283 run; Output Added: ------------- Name: ProductLimitEstimates Label: Product-Limit Estimates Template: Stat.Lifetest.ProductLimitEstimates Path: Lifetest.Stratum1.ProductLimitEstimates ------------- Output Added: ------------- Name: Quartiles Label: Quartiles of the Survival Distribution Template: Stat.Lifetest.Quartiles Path: Lifetest.Stratum1.TimeSummary.Quartiles ------------- 01/201516

17 Output Added: ------------- Name: Means Label: Mean Template: Stat.Lifetest.Means Path: Lifetest.Stratum1.TimeSummary.Means ------------- Output Added: ------------- Name: SurvivalPlot Label: Survival Curve Template: Stat.Lifetest.Graphics.ProductLimitSurvival Path: Lifetest.Stratum1.SurvivalPlot ------------- Output Added: ------------- Name: CensoredSummary Label: Censored Summary Template: Stat.Lifetest.CensoredSummary Path: Lifetest.CensoredSummary ------------- 01/201517

18 2 other ODS commands Produce graphical output. Output varies depending the Proc. ODS GRAPHICS ON; PROC LIFETEST DATA=allison.myel PLOTS=S; TIME dur*status(0); RUN; ODS GRAPHICS OFF; 01/201518

19 01/201519 8 1 1 1 180 1 2 0 632 1 2 0 852 0 1 0 52 1 1 1 2240 0 2 0 220 1 1 0 63 1 1 1 195 1 2 0 76 1 2 0 70 1 2 0 8 1 1 0 13 1 2 1 1990 0 2 0 1976 0 1 0 18 1 2 1 700 1 2 0 1296 0 1 0 1460 0 1 0 210 1 2 0 63 1 1 1 1328 0 1 0 1296 1 2 0 365 0 1 0 23 1 2 1 Data for the Myelomatous data set, Allison

20 01/201520 DATA myel; INPUT dur status treat renal; DATALINES; 8 1 1 1 180 1 2 0 632 1 2 0 852 0 1 0 52 1 1 1 2240 0 2 0 220 1 1 0 63 1 1 1 195 1 2 0 76 1 2 0 70 1 2 0 8 1 1 0 13 1 2 1 1990 0 2 0 1976 0 1 0 18 1 2 1 700 1 2 0 1296 0 1 0 1460 0 1 0 210 1 2 0 63 1 1 1 1328 0 1 0 1296 1 2 0 365 0 1 0 23 1 2 1 ; run; SAS programme to read the Data for the Myelomatous data set, Allison

21 01/201521 PROC LIFETEST DATA=myel; TIME dur*status(0); RUN; Proc Lifetest ; Some Important Options DATA = SAS-data-set OUTSURV = data set containing survival estimates METHOD = KM/PL (Kaplan-Meier); LIFE (actuarial) PLOTS = S (survival); LS (log-survival); LLS (log-log survival); H (hazard)

22 01/201522

23 01/201523

24 01/201524 libname allison 'C:/allison_2010/data_sets'; ODS GRAPHICS ON; ODS HTML style=statistical; PROC LIFETEST DATA=allison.myel PLOTS=S; TIME dur*status(0); RUN; ODS HTML close; ODS GRAPHICS OFF;

25 Aside re: ‘plots’ To get more than one plot, place the request in brackets: proc lifetest data=allison.myel plots=(s,h,lls) 01/201525

26 01/201526

27 01/201527 libname allison 'C:/allison_2010/data_sets'; ODS GRAPHICS ON; ODS HTML style=statistical; PROC LIFETEST DATA=allison.myel PLOTS=S(NOCENSOR ATRISK CL); TIME dur*status(0); RUN; ODS HTML close; ODS GRAPHICS OFF;

28 01/201528

29 01/201529 libname allison 'C:/allison_2010/data_sets'; ODS GRAPHICS ON; ODS HTML style=statistical; PROC LIFETEST DATA=allison.myel PLOTS=S(NOCENSOR ATRISK CL CB=EP); TIME dur*status(0); RUN; ODS HTML close; ODS GRAPHICS OFF;

30 01/201530

31 01/201531 libname allison 'C:/allison_2010/data_sets'; PROC LIFETEST DATA=allison.myel OUTSURV=a; TIME dur*status(0); RUN; Proc Print data=a; Run;

32 01/201532

33 01/201533 libname allison 'C:/allison_2010/data_sets'; ODS OUTPUT ProductLimitEstimates=a; PROC LIFETEST DATA=allison.myel; TIME dur*status(0); RUN; Proc Print data=a; Run;

34 01/201534

35 Reading data from a text file into SAS 01/201535

36 01/201536 Sample Data (as given in file to be read) 1 56 0 2 7 1 3 21 0 4 62 0 5 38 0

37 01/201537 Sample Data (showing columns) 123456789012345 1 56 0 2 7 1 3 21 0 4 62 0 5 38 0 Formats for data Col 1, F2.0 Col 4, F2.0 Col 7, F1.0

38 01/201538 Code to read in data. filename in ‘C:\data\sample1.txt’; data njb1; infile in; input @1 ID 2. @4 survtime 2. @7 status 1. ; run; proc print data=njb1 (obs=20); run;

39 01/201539


Download ppt "01/20151 EPI 5344: Survival Analysis in Epidemiology SAS code and output February 24, 2015 Dr. N. Birkett, School of Epidemiology, Public Health & Preventive."

Similar presentations


Ads by Google