I will also encourage you to use the "hazardratio" statement. It can easily calculate the estimated hazardratio for each level of some effectmodificator (effectmodification = interaction, just an other word for same thing).
A little problem I have with this is that it doesnt always select the reference level correctly when using the glm-parametrizaion. If the default parametrization is used, then both maineffects and interaction effects should be in the modelstatement.
Here a simple example.
data mydata;
do group=1,2;
do exposure='yes','no';
do i=1 to 10000;
rate=0.1*(3**(group=2))*(1.5**((exposure='yes')*(group=1))) * 2**((exposure='yes')*(group=2)) ;
t=rand('exponential',1/rate);
output;
end;
end;
end;
run;
*estimate the exposure effect for each of the two groups:;
proc phreg data=mydata;
class group exposure(ref='no');
model t=exposure*group exposure group;
hazardratio exposure/at(group=all) dif=ref;
run;
*Same again, but with glm-parametrization - then it is enough only to specifiy interaction as that include here maineffects;
proc phreg data=mydata;
class group exposure(ref='no')/param=glm;
model t=exposure*group;
hazardratio exposure/at(group=all) dif=ref;
run;
If you use the "by" statement, then you allow the model to have a different baseline hazard function for each value of the by-variable. So it will not give exactly same estimate. That will also give a little loss in statistical power.
Good luck;-)
... View more