06-12-2018 07:24 PM - edited 06-13-2018 12:16 AM
I am using proc phreg to estimate hazard ratios, my model is as follows:
time*event(0) = week|avg education race;
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?
06-12-2018 08:54 PM
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...
06-13-2018 12:21 AM
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?
|Estimate||Exp summed estimate||Hazard Ratio from SAS|
06-13-2018 12:42 AM
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?
06-13-2018 10:42 AM
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.