BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
riya275
Obsidian | Level 7

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
FreelanceReinh
Jade | Level 19

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.

View solution in original post

2 REPLIES 2
Reeza
Super User

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;
FreelanceReinh
Jade | Level 19

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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 9341 views
  • 1 like
  • 3 in conversation