(I'm using SAS 9.4)
I'm using PROC ICLIFETEST to estimate left-censored data. The output gives me the 25th, 50th, and 75th percentiles, but I want to find the estimated value for any percentile AND be able to return the percentile for an estimated value that I choose? Is there a way to do this? This is my code:
proc iclifetest data=base method=turnbull plots=survival(failure)
impute(seed=051513);
time (cd_left,cd_right);
run;
I'm not an expert in this area, so I'm not sure if this is what you want, but look at the section of the doc called "Quartile Estimation."
If that is what you want, you can use the OUTSURV= data set to obtain the survival probabilities at the right boundary of the intervals.
Try using the TIMELIST option, on PROC LIFETEST, but realize that the KM curve is a stepped curve, so that the values may overlap considerably.
If you only have left-censored data then you can just calculate the kaplan meier estimate to the inverse of response variable. The estimated percentile should then be transformed back. With this trick the problem of left censoring is made to a problem with right censoring, and therefore we can use a SAS procedure to calculate the Kaplan Meier estimate. Of course, this works only if the response variable can only be positive.
I made this example which find the 75% percentile of a serie of gamma distributed responses which can be left censored. In the last step you can just write any other value than 0.75:
*generate left censored data;
*and generate the inverse of the variable;
data mydata;
do i=1 to 10000;
y=rand('gamma',10);
c=rand('gamma',10);
if y<c then do;
y=c;
d=1;
end;
else d=0;
invy=1/y;
output;
end;
run;
*calculate the kaplan meier estimate;
proc lifetest data=mydata plots=(s) maxtime=600 outsurv=kaplanmeier method=km;
time invy*d(1);
run;
data percentile;
set kaplanmeier(where=(survival>0.75)) end=end;
by invy;
if end;
y=1/invy; put y;
*compare with the theoretical percentile;
p=quantile('gamma',0.75,10);put p=;
run;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.