Hello,
I'm trying to get 95% confidence limits for 5, 10, and 15 year individually on my on my KM survival curve. I know how to get the bands on my plot using plots=(survival(cb=hw)), but how do I get the specific confidence limit for each of my 3 data points? All I get with my current code are the quartile estimates.
I'm using Proc LifeTest and here is my code by the way. What I don't know is if I'm supposed use an ODS statement, or if there is a step within proc-lifetest to calculate the 95% CIs. and WHERE in my code is this step supposed to go? (fairly new to SAS)
My code is below:
libname Hetal "\\tuftsmc\home\hpatel3\SAS Datasets";
run;
proc import out=hetal.ES_database datafile="\\tuftsmc\home\hpatel3\SAS Datasets\ES Database Edit.csv" dbms=csv replace; getnames=yes; datarow=2;
run;
ods graphics on / attrpriority=color;
Ods output survivalplot=survplot;
proc lifetest data=hetal.es_database conftype=loglog plot=(s) plots=(survival(cb=hw))
timelist=(5 10) outs=survival_rates reduceout;
time FU_Total*Status(0);
Title"5 & 10 Year Survival Estimate for ES";
run;
proc sgplot data=survplot noborder nowall;
step x=Time y=Survival / lineattrs=(color=darkblue thickness=2);
xaxis display=(noticks) label="Years" values=(0 to 10 by 2) min=0 max=10 labelattrs=(size=10 weight=bold );
yaxis label='Survival Probability' values=(0 to 1.0 by 0.2) min=0 max=1.0 labelattrs=(size=10 weight=bold);
inset / title="95% CI:10.4476 (5.770, 16.2245) " position=bottomright;
run;
Did you check all your output data sets?
Particularly, survival_rates?
@hpatel3 wrote:
Hello,
I'm trying to get 95% confidence limits for 5, 10, and 15 year individually on my on my KM survival curve. I know how to get the bands on my plot using plots=(survival(cb=hw)), but how do I get the specific confidence limit for each of my 3 data points? All I get with my current code are the quartile estimates.
I'm using Proc LifeTest and here is my code by the way. What I don't know is if I'm supposed use an ODS statement, or if there is a step within proc-lifetest to calculate the 95% CIs. and WHERE in my code is this step supposed to go? (fairly new to SAS)
My code is below:
libname Hetal "\\tuftsmc\home\hpatel3\SAS Datasets"; run; proc import out=hetal.ES_database datafile="\\tuftsmc\home\hpatel3\SAS Datasets\ES Database Edit.csv" dbms=csv replace; getnames=yes; datarow=2; run; ods graphics on / attrpriority=color; Ods output survivalplot=survplot; proc lifetest data=hetal.es_database conftype=loglog plot=(s) plots=(survival(cb=hw)) timelist=(5 10) outs=survival_rates reduceout; time FU_Total*Status(0); Title"5 & 10 Year Survival Estimate for ES"; run; proc sgplot data=survplot noborder nowall; step x=Time y=Survival / lineattrs=(color=darkblue thickness=2); xaxis display=(noticks) label="Years" values=(0 to 10 by 2) min=0 max=10 labelattrs=(size=10 weight=bold ); yaxis label='Survival Probability' values=(0 to 1.0 by 0.2) min=0 max=1.0 labelattrs=(size=10 weight=bold); inset / title="95% CI:10.4476 (5.770, 16.2245) " position=bottomright; run;
yes! I have the survival rates and quartile estimates, but not the confidence limits.
Hmm...please post a proc contents on the survival_rates data set.
Note that your next step uses the survplot data set not the survival_rates data.
proc contents data=survival_rates;run;
From the documentation the OUTSURV/OUTS data sets include the following, which is what I get in my test. What happens if you run the code below? Does that generate the confidence intervals?
title 'Survival of Males with Angina Pectoris';
data Males;
keep Freq Years Censored;
retain Years -.5;
input fail withdraw @@;
Years + 1;
Censored=0;
Freq=fail;
output;
Censored=1;
Freq=withdraw;
output;
datalines;
456 0 226 39 152 22 171 23 135 24 125 107
83 133 74 102 51 68 42 64 43 45 34 53
18 33 9 27 6 23 0 30
;
ods graphics on;
proc lifetest data=Males
plots=(s,ls,lls,h,p) outs=survival_Rates timelist = (0 to 15 by 3) reduceout;
time Years*Censored(1) ;
freq Freq;
run;
ods graphics off;
You can specify the OUTSURV= option in the PROC LIFETEST statement to create an output data set that contains the survival estimates. The data set contains the following columns:
any specified BY variables
a numeric variable STRATUM
that numbers the strata, if you specify the STRATA statement
any specified STRATA variables, their values coming from either their original values or the midpoints of the stratum intervals if endpoints are used to define strata (semi-infinite intervals are labeled by their finite endpoint)
the GROUP= variables, if you specify the GROUP= option in the STRATA statement
the time variable as specified in the TIME statement. For METHOD=KM, METHOD=BRESLOW, or METHOD=FH, it contains the observed failure or censored times. For the life-table estimates, it contains the lower endpoints of the time intervals.
SURVIVAL
, a variable that contains the survivor function estimates
CONFTYPE
, a variable that contains the name of the transformation applied to the survival time in the computation of confidence intervals
SDF_LCL
, a variable that contains the lower limits of the pointwise confidence intervals for the survivor function
SDF_UCL
, a variable that contains the upper limits of the pointwise confidence intervals for the survivor function
@hpatel3 wrote:
yes! I have the survival rates and quartile estimates, but not the confidence limits.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.