Obsidian | Level 7

## Proc Lifetest - median survival time

Is there a way to just get the quartiles table using Proc lifetest.

I want to extract the median ( and mean) survival time from proc lifetest.

When I use the code -

``````proc lifetest data=graph2 ;
time time*status(0);
strata drg_class_detail;
run;``````

It gives me the Product limit survival estimates as well -

```                                                       The LIFETEST Procedure

Stratum 1: drg_class_detail = BIGUANIDES

Product-Limit Survival Estimates

Survival
Standard    Number    Number
time     Survival    Failure      Error      Failed     Left

0.00       1.0000           0           0        0     75699
0.00            .           .           .        1     75698
0.00            .           .           .        2     75697
0.00            .           .           .        3     75696
0.00            .           .           .        4     75695
0.00            .           .           .        5     75694
0.00            .           .           .        6     75693
0.00            .           .           .        7     75692
0.00            .           .           .        8     75691 ```

Since I have a lo of data and a lot of categories the result is very big in size.

Is there a way to just get the median and mean survival times?

1 ACCEPTED SOLUTION

Accepted Solutions

## Re: Proc Lifetest - median survival time

Hello @riya275,

Use the ODS SELECT statement to extract the tables you need:

``````ods select quartiles means;
proc lifetest data=graph2;
time time*status(0);
strata drg_class_detail;
run;``````

To find out the table names (here: quartiles and means) look into the ODS Table Names section of the procedure documentation (under "Details") or run the PROC step with ODS TRACE ON.

2 REPLIES 2
Super User

## Re: Proc Lifetest - median survival time

Here's some instructions and explanations on how to capture output that is shown.
https://blogs.sas.com/content/sastraining/2017/03/31/capturing-output-from-any-procedure-with-an-ods...

You can use ODS SELECT/ODS EXCLUDE to limit the tables shown. This will generate NO output and save your tables. If you do wat specific tables, list them in the ODS SELECT name.

https://documentation.sas.com/?docsetId=statug&docsetVersion=15.1&docsetTarget=statug_lifetest_detai...

``````ods select none;

proc lifetest data=graph2;
ods output means = mean_surv quartiles= median_surv;
time time*status(0);
strata drg_class detail;
run;

ods select all;``````

## Re: Proc Lifetest - median survival time

Hello @riya275,

Use the ODS SELECT statement to extract the tables you need:

``````ods select quartiles means;
proc lifetest data=graph2;
time time*status(0);
strata drg_class_detail;
run;``````

To find out the table names (here: quartiles and means) look into the ODS Table Names section of the procedure documentation (under "Details") or run the PROC step with ODS TRACE ON.

Discussion stats
• 2 replies
• 9266 views
• 1 like
• 3 in conversation