Programming the statistical procedures from SAS

Proc Lifetest - Number at Risk Vs Number Left

Accepted Solution Solved
Reply
Super Contributor
Posts: 252
Accepted Solution

Proc Lifetest - Number at Risk Vs Number Left

Hello,

Do you know why the atrisk numbers are different on a survival curve compared to the atrisk numbers that are in the ods ProductLimitEstimates dataset in the NumberAtRisk column? It seems like the atrisk numbers on the survival curve correspond to the Left column (Number Left) in the ods ProductLimitEstimates dataset? Can you help please?

Many thanks,

Kriss Harris Smiley Happy


Accepted Solutions
Solution
‎11-12-2014 12:47 PM
Grand Advisor
Posts: 16,916

Re: Proc Lifetest - Number at Risk Vs Number Left

You can generate the source code for the graph and see it references the ATRISK, check the log...

ods trace on;

ods output ProductLimitEstimates = surv;

proc lifetest data=sashelp.BMT plots=survival(atrisk=0 to 2500 by 500) atrisk timelist = 0 to 2500 by 500;

   time T * Status(0);

   strata Group / test=logrank adjust=sidak;

run;

ods trace off;

proc template;

source Stat.Lifetest.Graphics.ProductLimitSurvival;

run;quit;

View solution in original post


All Replies
Grand Advisor
Posts: 16,916

Re: Proc Lifetest - Number at Risk Vs Number Left

Can you post some sample data with this issue?

Super Contributor
Posts: 252

Re: Proc Lifetest - Number at Risk Vs Number Left

Okay, I will create some. Thanks.

Super Contributor
Posts: 252

Re: Proc Lifetest - Number at Risk Vs Number Left

SurvivalPlot91.png
Hi Reeza,

Here is the sample code:

ods output ProductLimitEstimates = out.surv;

proc lifetest data=sashelp.BMT plots=survival(atrisk=0 to 2500 by 500) atrisk timelist = 0 to 2500 by 500;

   time T * Status(0);

   strata Group / test=logrank adjust=sidak;

run;

I can't attach the dataset at the moment, but you will see what I mean when you run the program and compare the Left Column with the NumberAtRisk column and then also compare them to the graph.

Thanks.


Grand Advisor
Posts: 16,916

Re: Proc Lifetest - Number at Risk Vs Number Left

For the code I ran, number at risk=number left because there are no ties or multiple occurrences with censors at the same time in this data.

The number left = number at risk seems to make sense intuitively to me except possibly when a censored and event occur at the same time?

Super Contributor
Posts: 252

Re: Proc Lifetest - Number at Risk Vs Number Left

Okay thank you. Do you know which Atrisk values we should be using please when there are differences between number at risk and number left?

Solution
‎11-12-2014 12:47 PM
Grand Advisor
Posts: 16,916

Re: Proc Lifetest - Number at Risk Vs Number Left

You can generate the source code for the graph and see it references the ATRISK, check the log...

ods trace on;

ods output ProductLimitEstimates = surv;

proc lifetest data=sashelp.BMT plots=survival(atrisk=0 to 2500 by 500) atrisk timelist = 0 to 2500 by 500;

   time T * Status(0);

   strata Group / test=logrank adjust=sidak;

run;

ods trace off;

proc template;

source Stat.Lifetest.Graphics.ProductLimitSurvival;

run;quit;

Super Contributor
Posts: 252

Re: Proc Lifetest - Number at Risk Vs Number Left

Thank you for this Reeza, I'll check.

Super Contributor
Posts: 252

Re: Proc Lifetest - Number at Risk Vs Number Left

Hi Reeza,

Thank you for helping out with this. I've just gone back to it, and I can see that the template does reference the ATRISK number. I wonder why the plot uses the Left column then?

Super Contributor
Posts: 252

Re: Proc Lifetest - Number at Risk Vs Number Left

From reading Jack Shostak's book, I've seen that a solution to the question mentioned above is to output the "survivalplot" dataset.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 1071 views
  • 3 likes
  • 2 in conversation