1 / 32

EPI 5344: Survival Analysis in Epidemiology SAS code and output February 25, 2013

EPI 5344: Survival Analysis in Epidemiology SAS code and output February 25, 2013. Dr. N. Birkett, Department of Epidemiology & Community Medicine, University of Ottawa. SAS Output Delivery System (ODS). Default method for getting output from SAS procedures Can produce: printed results

meryl
Download Presentation

EPI 5344: Survival Analysis in Epidemiology SAS code and output February 25, 2013

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EPI 5344:Survival Analysis in EpidemiologySAS code and outputFebruary 25, 2013 Dr. N. Birkett, Department of Epidemiology & Community 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

  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 • 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 • the Results Window

  4. ODS produces output which has two components

  5. 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; 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;

  6. ODS pdf style=Normal ODS pdf style=Torn ODS pdf style=Journal

  7. HTML Output

  8. RTF Output - displayed in Word

  9. PDF Output

  10. Graphics example

  11. Graphics example

  12. 2 other ODS commands Get a list of the tables created by a Proc. Use to link data into subsequent Procs; ODS trace on; procfreq data=t1; run; ODS trace off; 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;

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

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

  15. PROC LIFETEST DATA=myel; TIME dur*status(0); RUN; ProcLifetest <options>; 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)

  16. libnameallison '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;

  17. Aside re: ‘plots’ • To get more than one plot, place the request in brackets: proclifetest data=allison.myel plots=(s,h,lls)

  18. libnameallison '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;

  19. libnameallison '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;

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

  21. Reading data from a text file into SAS

  22. Sample Data (as given in file to be read) 1 56 0 2 7 1 3 21 0 4 62 0 5 38 0

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

  24. Code to read in data. options ps = 58; options ls = 78; 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;

More Related