Programming the statistical procedures from SAS

HAZARDRATIO, Covariate Interactions, and Reference Parameterization

Senior User
Posts: 1

HAZARDRATIO, Covariate Interactions, and Reference Parameterization

[ Edited ]

Hi and thanks for your help! Currently using SAS_UE (SAS Studio)


1) When computing hazard ratios with PROC PHREG using the HAZARDRATIO statement, both the Point Estimates and 95% Wald Confidence Limits seem to vary depending on which values are used as the 'Reference' values for the involved variables.


2) However, the HR's no longer vary with Reference changes if the interaction variable is removed from the model; when it is removed, the HR's are the same regardless of the reference values used. Not sure why that would be the case if I'm only calculating the HR at one value of Margins





0 = No surgery

1 = Negative margins

2 = Positive margins



0 = No surgery 

1 = Type1 surgery

2 = Type2 surgery


PROC PHREG data=work.import simple ;



Margins (Ref="No surgery")    /* Why does changing the reference value change the hazard ratios */
Surgery (Ref="None")          /* Why does changing the reference value change the hazard ratios */

/ param=Ref;

MODEL Time*Censor(1)=






/ selection=backward;


HAZARDRATIO Surgery / at (Margins="Positive") diff=all;


So ultimately, if I want to compare Type1 and Type2 surgeries when Margins="Positive" (and also compare when Margins=Negative):

A) Do I even need the interaction variable? Why not just leave them separate and do HAZARDRATIO at Margins="Positive"

B) Should I set the Reference values to Surgery="Type2" and Margins="Positive" because those values are evaluated in the HAZARDRATIO statement? or should I use reference values that are won't be assessed in the HAZARDRATIO statement (like Surgery="No surgery", and Margins="Negative" or "No surgery").


Tabulated the HR's, ran +/– interaction term and changing the reference values for Surgery and Margins

Each HR here is from Results for [Surgery Type1 vs Type2 At Margins=Positive] 

Intreraction?Surgery RefMargins RefHRLlimitUlimit
No interactionType1Negative0.3240.2530.414
No interactionNoneNegative0.3240.2530.414
No interactionType2Negative0.3240.2530.414
No interactionType1Positive0.3240.2530.414
No interactionNonePositive0.3240.2530.414
No interactionType2Positive0.3240.2530.414


Thank you!!



Occasional Contributor
Posts: 11

Re: HAZARDRATIO, Covariate Interactions, and Reference Parameterization


    I'm not sure how familiar you are with the concept of hazard ratios, but I'll try answer your general question "Why do the hazard ratios change when I change the reference value."  A hazard ratio is looking at the "hazard" of being in one group compared to another group (the reference) in regards to the event in your model (e.g. tumor recurrence). 


In colon cancer males tend to perform worse than females in terms of the tumor growing back (recurring).  If you were to look at the hazard ratio for gender regarding time to recurrence in colon cancer, the hazard ratio would be greater than 1 if females were the reference.  This is because groups that have a hazard ratio greater than 1 have more "hazard" compared to the reference group (are worse off).  Therefore if you switched the reference group to be the males, then the hazard ratio would become less than 1 (females are better off than the males in the reference group).

For example:

  • Males are reference group => Females vs Males => Hazard Ratio =0.6 => Females are better off than males
  • Females are reference group => Males vs Females => Hazard ratio =1.67 => Males are worse off than females


When I read the syntax for the HAZARDRATIOS statement it refers to variables involved in interaction terms when you use the AT option.  I believe this is why your hazard ratios don't change when you remove the interaction term.  There is no longer an interaction term for the AT option to do anything, and doesn't care what the reference value is of margins.  When you say that your table includes the hazard ratios for the Surgery Type1 vs Type2 At Margins=Positive case, that means that you are only showing the values where TYPE2 is the reference value regardless of what you put in your CLASS statement, and the MARGINS variable no longer matters so the hazard ratios are always the same (with no interaction term).


I notice that you are using the DIFF=ALL option in your HAZARDRATIOS statement as well, this makes it give you all the hazard ratios for each of the potential reference values.  If you only want to see the hazard ratios for the reference values you specify in your CLASS statement, then use DIFF=REF instead.


Now when you include the interaction term there is a lot more complicated calculation going on to get the hazard ratio that depends on the reference values for both variables.  Your "Surgery Type1 vs Type2 At " will always tell you what your variable's current reference value is, but then the value will change based on the value of MARGIN, and whether that value is currently the reference group or not.  This is why the values change in the table when you modify the reference value of MARGIN with the interaction term in the model.  I don't know the actual stat theory formulas to show why though.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation