turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- How do I find a specific percentile value in PROC ...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-08-2016 01:45 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-08-2016 02:06 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-08-2016 02:09 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-08-2016 02:10 PM - edited 03-08-2016 02:41 PM

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