BookmarkSubscribeRSS Feed
chelseaxxlutz
Obsidian | Level 7

Hello and thank you in advance for your help. I am trying to compare the predicted risk (via Cox/proc phreg) and expected risk (via Kaplan Meier/proc lifetest) by splitting observations into deciles of risk. Using the following code for proc lifetest, I am able to get the risk and survival for each observation/event. However, now I need to do the same for proc phreg/Cox but have been unable to find a way to get SAS to spit out anything other than the risk for the overall sample (such as using the outset statement, or the baseline covariate statement). Would anyone know how to do this please! This is very time sensitive! Thank you!

 

Is there a way to get the predicted survival/risk for each observation using proc phreg, not just the number at risk at each time point? For example, using the following, I get a survival and risk for each event/non event observation. But this is using Kaplan Meier/proc lifetest, and I'm hoping there's a way to do it using proc phreg? Thank you!

ods trace on;

ods output productlimitestimates=predkm2;

proc lifetest data=incidentvalid method=km;

test sex agecateg bmicateg diabetes prevhyp prevap prevmi cholcateg smokecateg;

time timedth*death(0);

run;

proc rank data=predkm2 groups=10 out=validkmrank;

var survival;

ranks decile;

run;

proc print data=validkmrank ;

run;

 

Cox code so far...

ods graphics on;

proc phreg data=incidentvalid concordance plot(overlay)=survival;

class sex (ref='2') agecateg(ref='1') bmicateg(ref='1') diabetes(ref='0') prevhyp(ref='0') prevap(ref='0') prevmi(ref='0') cholcateg(ref='1') smokecateg(ref='1');

model timedth*death(0)= sex agecateg bmicateg diabetes prevhyp prevap prevmi cholcateg smokecateg/rl;

baseline covariates=incidentvalid out=_null_;

output out=out atrisk=atrisk /order=sorted;

run;

 

But I need more than just the number at risk... I need the survival and risk...

 

1 REPLY 1
Reeza
Super User

How are you defining 'risk'?

 

The Survival estimates are created by adding SURVIVAL to the OUTPUT statement. I think I mentioned this to you before, but if not, it helps if you post code that we can actually run. So this means either taking the time to create a test data set or using the data set from SASHELP or the documentation examples as a data source.

 

output out=out atrisk=atrisk SURVIVAL = P_SURVIVAL /order=sorted;

 

I've linked you to the relevant documentation section as well. 

http://documentation.sas.com/?docsetId=statug&docsetTarget=statug_phreg_syntax18.htm&docsetVersion=1...

 

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 1788 views
  • 0 likes
  • 2 in conversation