I added one level to var1, it is three levels categorical variable now.
If the reference group of one categorical variable in the interaction term, HR is just exp(coefficient estimate of the interaction term) in the ParameterEstimate, but for the interaction term that both categorical are non-reference group, the HR calc involved the coefficient of main effect estimate in the ParamerEstimate table, p-value will not be the same as the p-value for the coefficient of the interaction term (attached the output here). Let me know if I am wrong.
data testp; input val trt censor var1 var2; datalines; 3 1 0 2 2 18.9 1 1 1 5 3.6 1 0 2 2 6.5 1 0 3 7 13.5 1 1 1 4 11 1 1 1 1 3.8 1 0 2 3 3.8 1 1 2 4 10.5 1 0 2 3 2.3 1 0 1 8 3.1 1 0 2 6 2.3 1 0 3 2 1 2 1 1 2 3.7 2 1 2 5 7.8 2 1 3 7 2.4 2 0 3 9 2.5 2 1 2 5 6.8 2 0 1 3 6.3 2 0 2 4 2.4 2 1 1 3 1.7 2 0 2 6 7.8 2 0 3 8 16.4 2 1 1 3 3.8 2 0 2 2
; run; proc print; run;
proc phreg data=testp; class trt(ref="2")/param=ref ; model val*censor(1) = trt var2 trt*var2/rl ties=efron ; hazardratio 'var2' var2/units=10 cl=both; hazardratio 'trt' trt/ at(var2=1) cl=both alpha=0.10; run; ods output ParameterEstimates=est; proc phreg data=testp; class trt(ref="2") var1(ref="2")/param=ref; model val*censor(1) = trt var1 trt*var1/rl ties=efron ;
hazardratio 'var1' var1/diff=ref at(trt='1') cl=both; hazardratio 'var1' var1/diff=ref at(trt='2') cl=both;
hazardratio 'trt' trt/diff=ref at(var1='1') cl=both; hazardratio 'trt' trt/diff=ref at(var1='2') cl=both; run;
data est1; set est; exp_est = exp(estimate); run;
proc print data = est1; run;
... View more