@sbxkoenk @WarrenKuhfeld Thank you both for your valuable inputs. I was able to finally get what I needed by running survival plot and limit estimates for both CNSR(0) and CNSR(1) extracting the numbers that I needed for my table. I will definitely take a closer look at this macro and documentation for future reference! Amazing work.
/* First run for cnsr(0) */
ods trace on;
ods graphics on;
ods listing close;
ods output CensoredSummary = CensoredSummary0
ProductLimitEstimates = SurvivalEstimates0
SurvivalPlot = SurvivalPlot0;
proc lifetest data=adtteqs plots=survival(atrisk= 0 to 48 by 3) timelist=(0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48) reduceout outsurv=survdata0;
time avalM * cnsr(0);
strata trtp;
by &Subgrp;
run;
/* Close the ODS destination to save the first set of outputs */
ods trace off;
ods graphics off;
ods listing;
/* Second run for cnsr(1) */
ods trace on;
ods graphics on;
ods listing close;
ods output CensoredSummary = CensoredSummary1
ProductLimitEstimates = SurvivalEstimates1
SurvivalPlot = SurvivalPlot1;
proc lifetest data=adtteqs plots=survival(atrisk= 0 to 48 by 3) timelist=(0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48) reduceout outsurv=survdata1;
time avalM * cnsr(1);
strata trtp;
by &Subgrp;
run;
/* Close the ODS destination to save the second set of outputs */
ods trace off;
ods graphics off;
ods listing;
data survivalplot (drop=Atrisk stratum_ survival event censored stratum tAtrisk);
set survivalplot0;
where cmiss(tAtRisk) = 0;
Number_At_Risk =atrisk;
stratum_=stratum;
trtp=Stratum_;
run;
proc sort data= survivalplot(rename=stratumnum=stratum);
by paramcd stratum time;
data SurvEst_nevents (drop=Timelist Failed Left survival censor Failure StdErr AvalM);
format TimeList avalM 8.;
set SurvivalEstimates1;
Time = Timelist;
Number_of_Events =Failed;
Overall_Survival= survival;
run;
proc sort data= SurvEst_nevents;
by paramcd stratum time;
data SurvEst_ncensevents (drop=Timelist Failed Left survival censor Failure StdErr AvalM);
format TimeList avalM 8.;
set SurvivalEstimates0;
Time = Timelist;
Number_Censored =Failed;
run;
proc sort data= SurvEst_ncensevents;
by paramcd stratum time;
data merged_data(drop=stratum);
retain paramcd time Overall_Survival Number_At_Risk Number_Censored Number_of_Events Trtp;
merge survivalplot (in=a)
SurvEst_nevents (in=b)
SurvEst_ncensevents (in=c);
by paramcd stratum time;
if a & b & c;
run;
... View more