BookmarkSubscribeRSS Feed
acuffza
Calcite | Level 5

(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;

3 REPLIES 3
Rick_SAS
SAS Super FREQ

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.

 

Reeza
Super User

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. 

 

 

JacobSimonsen
Barite | Level 11

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;

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 3 replies
  • 3188 views
  • 1 like
  • 4 in conversation