Programming the statistical procedures from SAS

How do I find a specific percentile value in PROC ICLIFETEST?

Reply
Occasional Contributor
Posts: 18

How do I find a specific percentile value in PROC ICLIFETEST?

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

SAS Super FREQ
Posts: 3,547

Re: How do I find a specific percentile value in PROC ICLIFETEST?

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.

 

Super User
Posts: 18,549

Re: How do I find a specific percentile value in PROC ICLIFETEST?

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. 

 

 

Super Contributor
Posts: 287

Re: How do I find a specific percentile value in PROC ICLIFETEST?

[ Edited ]

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;

 

Ask a Question
Discussion stats
  • 3 replies
  • 418 views
  • 1 like
  • 4 in conversation