Download presentation
Presentation is loading. Please wait.
Published byJennifer Barber Modified over 8 years ago
1
Kaplan-Meier Survival Plotting Macro %NEWSURV Jeffrey Meyers Mayo Clinic, Rochester, Minnesota 1 BB-13
2
#pharmasug Contents Macro Overview What the macro does How the macro does it – Computed Statistics – Designing the Plot – Designing the Lattice Statistical Report Table Conclusion 2
3
#pharmasug Macro Overview (Plot) 3
4
#pharmasug Macro Overview (Statistical Report) 4 General Statistical Report Table Example Event/Total Median (95% CI) † Hazard Ratio (95% CI) ‡ Survival Estimates (95% CI) † P-value SASHELP.BMT Data set with no Class Variable All Patients83/1371.3 (1.0-2.9)1 Years: 58.3 (50.6-67.2) 2 Years: 42.0 (34.5-51.2) This is the footnote for this model SASHELP.BMT Data set with Class Variable Group0.0010 $ ALL24/381.1 (0.5-NE)Ref1 Years: 54.9 (41.1-73.4) 2 Years: 35.3 (22.7-54.8) AML-High Risk34/450.5 (0.3-1.2)1.47 (0.87-2.48)1 Years: 37.8 (26.0-55.0) 2 Years: 24.4 (14.6-40.9) AML-Low Risk25/546.0 (1.9-NE)0.56 (0.32-0.99)1 Years: 77.8 (67.4-89.7) 2 Years: 61.1 (49.4-75.6) This is the footnote for this model † Kaplan-Meier method; ‡ Cox model; $ Score test; This also allows an overall footnote
5
#pharmasug Sample Dataset SASHELP.BMT – SAS 9.3 GROUP – categorical – Acute Lymphoblastic Leukemia (ALL) – Acute Myeloid Leukemia (AML) High Risk and Low Risk T – time from transplant STATUS – survival status – 0=Alive – 1=Dead 5
6
#pharmasug Only Required Variables DATA, TIME, CENS, CEN_VL Dataset Transformations LANDMARK CLASS & WHERE XDIVISOR 6 Line and Axes Transformations COLOR & PATTERN XMIN, XMAX, &XINCREMENT YTYPE, YMIN, YMAX & YINCREMENT Plot Summary Table Options CLASSORDER CLASSVALALIGN TIMELIST & TIMEDX CLASSREF PLOTPVAL DISPLAY Key Features/Parameters %NEWSURV(…, CLASSORDERMETHOD=list, CLASSORDER=3 1 2, CLASSREF=AML-Low Risk, CLASSVALALIGN=left, DISPLAY=legend total event hr pval timelist, PLOTPVAL=logrank, TIMELIST=0.5 1, TIMEDX=Years); %NEWSURV(…, CLASS=group, WHERE=group in('ALL' 'AML-High Risk'), XDIVISOR=30.44, LANDMARK=3.0); %NEWSURV( DATA=sashelp.bmt, TIME=T, CENS=status, CEN_VL=0); %NEWSURV(…, PATTERN=2 3 4, COLOR=blue red green, LINESIZE=3pt, SYMBOLSIZE=10pt, YTYPE=ppt, YMIN=0.25,YMAX=1,YINCREMENT=0.05, XMIN=0,XMAX=7.5,XINCREMENT=0.5, YLABEL=Proportion Alive, XLABEL=Disease-Free Survival Time (Years));
7
#pharmasug Patients-at-Risk Table Variations 7 %newsurv(…, RISKLABELLOCATION=left, RISKLOCATION=bottom, RISKLIST=0 to 7.5 by 0.5, RISKCOLOR=1, PARHEADER=Patients-at-Risk); RISKLABELLOCATION PARHEADER RISKLOCATION RISKCOLOR
8
#pharmasug Lattice of Plots 8 %NEWSURV(TIME=T|T, CENS=status,CEN_VL=0, SREVERSE=1|0, ROWS=1,COLUMNS=2, ORDER=rowmajor, TITLE=%str(A%))|%str(B%)), FOOTNOTE=Footnote1|Footnote2, OVTITLE=Title for entire image, OVFOOTNOTE=Footnote for entire image,…); OVTITLE TITLE FOOTNOTE OVFOOTNOTE SREVERSE
9
#pharmasug Output Methods RTF, PDF, HTML, Listing Various file types (PNG, JPEG, TIFF, EMF, …) DPI settings Scalable vector graphics (9.3 and later) From macro vs. within ODS tags 9
10
#pharmasug Error Checking Macro checks most parameter input Custom error messages: ERROR: (Model 1: DISPLAY): TOTL is not in the list of valid values ERROR: (Model 1: DISPLAY): Possible values are LEGEND|HR|MEDIAN|TOTAL|EVENT|TIMELIST| PVAL|TABLECOMMENTS ERROR: 1 pre-run errors listed ERROR: Macro NEWSURV will cease 10
11
#pharmasug Computed Statistics 2 LIFETEST procedures, 1 PHREG procedure N patients, N events Median time-to-event Kaplan-Meier event-free rate Cox proportional hazards ratio P-value Patients-at-risk numbers 11
12
#pharmasug LIFETEST #1 – OUTSURV Option 12 PROC LIFETEST DATA=sashelp.bmt OUTSURV=os1; STRATA group; TIME t*status(0); RUN;
13
#pharmasug LIFETEST #1 – ODS Output SURVIVALPLOT 13 ODS GRAPHICS ON; PROC LIFETEST DATA=sashelp.bmt PLOT(SURVIVAL(ATRISK=1000,2000)); STRATA group; TIME t*status(0); ODS OUTPUT SURVIVALPLOT=splot (KEEP=time tatrisk stratumnum atrisk WHERE=(tatrisk ^=.)); RUN;
14
#pharmasug LIFETEST #2 – OUTSURV Option w/REDUCEOUT OPTION 14 PROC LIFETEST DATA=sashelp.bmt OUTSURV=os2 REDUCEOUT TIMELIST=500 1000; STRATA group; TIME t*status(0); RUN;
15
#pharmasug LIFETEST #2 – ODS Output CENSOREDSUMMARY 15 PROC LIFETEST DATA=sashelp.bmt; STRATA group; TIME t*status(0); ODS OUTPUT CENSOREDSUMMARY=summary; RUN;
16
#pharmasug LIFETEST #2 – ODS Output QUARTILES 16 PROC LIFETEST DATA=sashelp.bmt; STRATA group; TIME t*status(0); ODS OUTPUT QUARTILES=quartiles; RUN;
17
#pharmasug LIFETEST #2 – ODS Output HOMTESTS 17 PROC LIFETEST DATA=sashelp.bmt; STRATA group / logrank wilcoxon; TIME t*status(0); ODS OUTPUT HOMTESTS=pval1; RUN;
18
#pharmasug PHREG – ODS Output PARAMETERESTIMATES 18 PROC PHREG DATA=sashelp.bmt; CLASS group; MODEL t*status(0) = group / RISKLIMITS; ODS OUTPUT PARAMETERESTIMATES=hazards (keep=classval0 hazardratio hrlowercl hruppercl); RUN;
19
#pharmasug PHREG – ODS Output TYPE3 19 PROC PHREG DATA=sashelp.bmt; CLASS group; MODEL t*status(0) = group / TYPE3(score lr); ODS OUTPUT TYPE3=pval2 (keep=effect problrchisq probscorechisq); RUN;
20
#pharmasug Statistics Saved as Macro Variables SUMMARY OS2 QUARTILES HAZARDS PVAL1 PVAL2 N patients/events Event-free rates Median time-to-event Hazard ratios Logrank/Wilcoxon Score/Likelihood-ratio 20 SQL Procedure
21
#pharmasug Only variables used in plot statements —Step plots —Censor scatterplots —Patients-at-risk scatterplots Plot Data Set 21
22
#pharmasug Plot Data Set – Step Plot and Censor Scatterplot Columns Variables – Cl#_#: CLASS level – T#_#: time – C#_#: Survival function estimate when censor – S#_#: Survival function estimate #_#: – First #: CLASS level number – Second #: model number 22
23
#pharmasug Plot Data Set – Step Plot and Censor Scatterplot Columns 23
24
#pharmasug Multiple Plots in One Window 24 STEPPLOT X=t Y=survival / GROUP=group NAME=‘stepplot’ LINEATTRS=(THICKNESS=4pt); DISCRETELEGEND ‘stepplot’ / …; STEPPLOT X=t1 Y=survival1 / LEGENDLABEL=“ALL” NAME=‘stepplot1’ LINEATTRS=(THICKNESS=4pt COLOR=blue PATTERN=1); STEPPLOT X=t1 Y=survival1 /…; STEPPLOT X=t2 Y=survival2 / LEGENDLABEL=“AML-High Risk” NAME=‘stepplot2’ LINEATTRS=(THICKNESS=4pt COLOR=cxB2182B PATTERN=4); STEPPLOT X=t2 Y=survival2 /…; STEPPLOT X=t3 Y=survival3 / LEGENDLABEL=“AML-Low Risk” NAME=‘stepplot3’ LINEATTRS=(THICKNESS=4pt COLOR=cx01665E PATTERN=8); DISCRETELEGEND ‘stepplot1’ ‘stepplot2’ ‘stepplot3’/ …; One STEPPLOT statement Multiple STEPPLOT statement
25
#pharmasug DATA _plot; MERGE os1 (WHERE=(group=“ALL”) RENAME=(t=t1 survival=survival1) KEEP=t1 survival1) os1 (WHERE=(group=“AML-High Risk”) RENAME=(t=t2 survival=survival2) KEEP=t2 survival2) os1 (WHERE=(group=“AML-Low Risk”) RENAME=(t=t3 survival=survival3) KEEP=t3 survival3); RUN; Turn Data by Categorical Variable into Multiple Variables 25
26
#pharmasug Plot Data Set – Patients-at-risk Scatterplot Variables Variables: – Time#_#: time-point values – Atrisk#_#: Number of patients-at-risk – Y#_#: Constant value of 1 EVAL function #_#: – First #: CLASS level number – Second #: model number 26
27
#pharmasug MARKERCHARACTER Option 27 382012 11410 0123456 1 SCATTERPLOT X=time1_1 Y=eval(y1_1*0+1) / … MARKERCHARACTER=ATRISK1_1; SCATTERPLOT X=time1_1 Y=eval(y1_1*0+1) / …;
28
#pharmasug Plot Data Set – Patients-at-risk Scatterplot Variables 28
29
#pharmasug Plot Data Set – Patients-at-risk Header Scatterplot Variables Variables: – parx_#: Constant value of 1 for EVAL function – pary_#: Constant value of 1 for EVAL function – partitle_#: Header text string _#: model number 29
30
#pharmasug Plot Layout 30 Model Title Model Footnote Plot Window Patients-at-Risk Window X-Label Y-Label Class Level 1 Class Level 2 Class Level 3 0510 15 20 25 30 0 5 10 15 20 25 Image taken from SAS 9.3 Graph Template Language Reference Model Title Model Footnote Plot Window X-Label Y-Label 0510 15 20 25 30 0 5 10 15 20 25
31
#pharmasug Plot Layout 31 This title is placed inside of a SIDEBAR block with ALIGN=TOP This footnote is placed inside of a SIDEBAR block with ALIGN=BOTTOM 0.00.51.01.52.02.53.03.54.04.55.05.56.06.57.07.5 Time (Years) 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 Proportion Alive and Disease-Free Censor 6.0 (1.9-NE)2554AML-Low Risk 0.5 (0.3-1.2)3445AML-High Risk 1.1 (0.5-NE)2438ALL Median (95% CI)EventTotalDisease Group 0.00.51.01.52.02.53.03.5 4.04.55.05.56.06.57.07.5 Time (Years) 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 Proportion Alive and Disease-Free Censor 6.0 (1.9-NE)2554AML-Low Risk 0.5 (0.3-1.2)3445AML-High Risk 1.1 (0.5-NE)2438ALL Median (95% CI)EventTotalDisease Group
32
#pharmasug Lattice of Plots 32
33
#pharmasug Lattice Layout of Plots Process Flow 33 Temporary data set w/transformations Analysis procedures Create plot and output data sets Create macro variables for ENTRY statements Begin template and define number of cells Create cell axes Run plot statements REPORT procedure SGRENDER procedure Run output options Delete temporary datasets Error Checking
34
#pharmasug Plot Summary Table 34
35
#pharmasug Create text Placed inside/outside plot Anchored by combination of position terms – Left/Center/Right – Top/Center/Bottom Powerful w/LAYOUT GRIDDED ENTRY Statements 35 0123456 1 Red Text Blue Text Green TextBlack Text Green Text X 2 <64 ENTRY HALIGN=center 'Red Text‘ / VALIGN=top TEXTATTRS= (COLOR=red SIZE=14pt); ENTRY HALIGN=left ‘Blue Text’ / VALIGN=bottom TEXTATTRS= (COLOR=blue SIZE=14pt); ENTRY HALIGN=left ‘Green Text’ / VALIGN=top TEXTATTRS= (COLOR=green SIZE=14pt); ENTRY HALIGN=left ‘Black Text’ / VALIGN=top TEXTATTRS= (COLOR=black SIZE=14pt); LAYOUT GRIDDED / ROWS=2 HALIGN=right VALIGN=top BORDER=true; ENTRY HALIGN=left ‘Green Text’ / VALIGN=top TEXTATTRS= (COLOR=green SIZE=14pt); ENTRY HALIGN=left ‘Black Text’ / VALIGN=top TEXTATTRS= (COLOR=black SIZE=14pt); ENDLAYOUT; ENTRY HALIGN=right "X" {sup "2"} {unicode "2264"x} "64" / VALIGN=bottom TEXTATTRS=(COLOR=black SIZE=14pt);
36
#pharmasug LAYOUT GRIDDED 36
37
#pharmasug Non-Visible Items Still Take up Space 37 White Line AML Low-Risk AML High-Risk ALL STEPPLOT X=t1 Y=survival1 / LINEATTRS=(color=white) NAME='white' LEGENDLABEL='White Line'; STEPPLOT X=t1 Y=survival1 / NAME=‘class1’ …; STEPPLOT X=t2 Y=survival2 / NAME=‘class2’ …; STEPPLOT X=t3 Y=survival3 / NAME=‘class3’ …; LAYOUT GRIDDED / COLUMNS=1 ROWS=2 …; DISCRETELEGEND ‘class1’ ‘class2’ ‘class3’ / …; DISCRETELEGEND 'white' / BACKGROUNDCOLOR=red OPAQUE=true …; ENDLAYOUT;
38
#pharmasug Rendering in Order 38 02505007501000125015001750200022502500 Disease-Free Survival Time 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 Survival Distribution Function Estimate ALL Black AML-Low Risk AML-High Risk ALL SCATTERPLOT X=t2 Y=survival2 / MARKERATTRS=(symbol=diamondfilled color=black) NAME='black' LEGENDLABEL='ALL Black'; SCATTERPLOT X=t Y=survival / MARKERATTRS=(symbol=diamondfilled) GROUP=group NAME='group'; DISCRETELEGEND 'black' 'group' / …;
39
#pharmasug + 0.61(0.49-0.76) LegendClass ValueTotalEventsTime-PointKM Estimate Score P - value:0.0010 Censor Table Comment1 2 3 ALL AML-High Risk AML-Low Risk 38 45 54 24 34 25 1Years 2 1 2 1 2 0.55(0.41-0.73) 0.35(0.23-0.55) 0.38(0.26-0.55) 0.24(0.15-0.41) 0.78(0.67-0.90) Plot Summary Table Design 39
40
#pharmasug Statistical Report Table 40 General Statistical Report Table Example Event/Total Median (95% CI) † Hazard Ratio (95% CI) ‡ Survival Estimates (95% CI) † P-value SASHELP.BMT Data set with no Class Variable All Patients83/1371.3 (1.0-2.9)1 Years: 58.3 (50.6-67.2) 2 Years: 42.0 (34.5-51.2) This is the footnote for this model SASHELP.BMT Data set with Class Variable Group0.0010 $ ALL24/381.1 (0.5-NE)Ref1 Years: 54.9 (41.1-73.4) 2 Years: 35.3 (22.7-54.8) AML-High Risk34/450.5 (0.3-1.2)1.47 (0.87-2.48)1 Years: 37.8 (26.0-55.0) 2 Years: 24.4 (14.6-40.9) AML-Low Risk25/546.0 (1.9-NE)0.56 (0.32-0.99)1 Years: 77.8 (67.4-89.7) 2 Years: 61.1 (49.4-75.6) This is the footnote for this model † Kaplan-Meier method; ‡ Cox model; $ Score test; This also allows an overall footnote
41
#pharmasug Multiple Macro Calls Can be Output in the same Report 41 Event/Total Survival Estimates (95% CI) † All Patients, In Years, Survival at 1 Year, Using Proportions Disease Group ALL24/38 1 Year: 0.55 (0.41-0.73) AML-High Risk34/45 1 Year: 0.38 (0.26-0.55) AML-Low Risk25/54 1 Year: 0.78 (0.67-0.90) This comes from the first macro call Time Landmarked at 500 Days, In Days, Subsequent Survival at 365 Days, Using Percentages Disease Group ALL3/16 365 Days: 0.80 (0.63-1.00) AML-High Risk2/13 365 Days: 0.85 (0.67-1.00) AML-Low Risk7/36 365 Days: 0.89 (0.79-1.00) This comes from the second macro call † Kaplan-Meier method; %NEWSURV(…, summary=0,out=table); %NEWSURV(…, summary=1,out=table, newtable=0);
42
#pharmasug 42 Name: Jeffrey Meyers Enterprise: Mayo Clinic Address: 200 1st St SW City, State ZIP: Rochester, MN 55905 Work Phone: 507-266-2711 E-mail: Meyers.Jeffrey@mayo.eduMeyers.Jeffrey@mayo.edu jpmeyers_spa@gmail.com Twitter: jmeyers_spa
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.