BookmarkSubscribeRSS Feed
psh23
Fluorite | Level 6

I am using proc phreg to estimate hazard ratios, my model is as follows: 

 

time*event(0) = week|avg education race;

random zipcode;

 

I would like to get the hazard ratio for 'week'. I was originally doing this by hand by summing the estimate from week and the interaction term, but assume there is a way to do this using estimate/contrast? 

 

Thank you!

5 REPLIES 5
Reeza
Super User

Try a HAZARDRATIO statement instead. Much simpler syntax. 

pau13rown
Lapis Lazuli | Level 10

youdont have week as a main factor in the model, just in the interaction? you'll need to use 'at' in the hazardratio statement @Reeza suggested, see here: https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_phreg_sect0...

psh23
Fluorite | Level 6

When I use the hazardratio statement I cannot recreate what I get when I am summing the coefficients by hand. This is why I wasn't using it initially - is there a specification that needs to be made?

 

Example:

 

 EstimateExp summed estimateHazard Ratio from SAS
average0.0001960.9997636280.995
week-0.0002121  
week*average-0.0000243  
pau13rown
Lapis Lazuli | Level 10

are you doing it by hand or in a data step? it could be rounding error, calculate the hr in a data step as exp(estimate). Also did you use 'at' in the hazard ratio statement? if you just sum them up then it's at average=1?

Reeza
Super User

99% of the time the error is with the hand calculation. 

 

Do it with a data step so you can't get any typo's or rounding errors and post your code if it still doesn't match.

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 5 replies
  • 1435 views
  • 0 likes
  • 3 in conversation