Kaplan-Meier KM Curves in Proc SGPlot

PHOTO EMBED

Mon Sep 29 2025 21:16:43 GMT+0000 (Coordinated Universal Time)

Saved by @ddover

ods output FailurePlot=EP_visit_plot;
Proc LifeTest Data=analysis timelist=90 180 365 730 1865 3285 
                            plots=survival(/*CB*/ failure nocensor test);
   Strata Sex_text;
   Time tt_EP*tt_EP_event(0);
run;

Data EP_visit_plot;
   Set EP_visit_plot; *reduce size*;
   if missing(_1_SURVIVAL_) and Time > 0 then delete;
run;

Proc SGPlot Data=EP_visit_plot;
   Step y=_1_SURVIVAL_  x=Time / group=stratum;
   refline 90 180 365 730 1865 3285 / axis=x;
   xaxis values=(0 90 180 365 730 1865 3285) min=0;
   yaxis max=1;
run;
quit;
content_copyCOPY