BookmarkSubscribeRSS Feed
Wafflecakes
Calcite | Level 5

Howdy yall,

 

Does anybody know alternatives to the hazardratio statement that allow the statistician to specify different units for continuous variables?  This statement does not offer p-values.

 

 

8 REPLIES 8
OsoGris
SAS Employee

You can use the  E option of the HAZARDRATIO statement to display the coefficient vector of the linear combination that gives rise to the hazard ratio.  Note that the E goes after a forward slash.  Suppose you desire a hazard ratio for a covariate named 'treatement'; for example,

 

HAZARDRATIO treatment / DIFF=REF E;

 

Then you can use those coefficients in a CONTRAST statement with the ESTMATE=EXP option which should replicate the hazard ratio value and also give a p-value.  The ESTIMATE=EXP also goes after a forward slash.  For example,

 

CONTRAST 'label' treatment . . . list of coefficients . . .  / ESTIMATE=EXP;

 

For a good example with categorical variables see Example 86.3 Modeling with Categorical Predictors which is informative.  In particular, the 3rd PHREG step there has HAZARDRATIO statements 'H1', 'H2' and 'H3' which correspond with CONTRAST statements 'C1', 'C2' and 'C3', respectively (and which naturally give the same results except that the CONTRAST statement also gives a p-value).    The entire example is informative but the material including and above Output 86.3.6 & Output 86.3.7 illustrates these corresponding HAZARDRATIO and CONTRAST statement results.

Wafflecakes
Calcite | Level 5
How would I figure out the coefficients for two-way interactions between categorical variables? I dont know how to come up with the design matrix.
OsoGris
SAS Employee

Norte: the above answer was geared towards a categorical variable.  I haven't tried the / E option in conjunction with the UNITS= option on the HAZARDRATIO statement with a continuous covariate.  If it doesn't work seamlessly you can always do the HAZARDRATIO/CONTRAST statement construct for UNITS=1 and then just manually exponentiate the resulting 1-unit hazard ratio (say HR_1) for UNITS=k as HR_k = (HR_1)**k.

OsoGris
SAS Employee

When you have an interaction term you cannot interpret the main effects in isolation.  You must involve the levels/value of the interacting variable(s).  So, regarding HAZARDRATIOS for interaction models you can still use the E option and the CONTRAST statement construct.  However, you will likely also need the AT= option to compute the hazard ratio  for a one variable at a particular level of the interacting covariate.   For instance, if continuous variables x1 and x2 appear in an interaction term then you can do something like:

 

HAZARDRATIO x1 / AT(x2=3) E;

 

Then you can take the coefficients to a CONTRAST statement with ESTIMATE=EXP as explained above.

OsoGris
SAS Employee

Sorry, again my reply was geared towards continuous variables which was your initial question.  Regarding interactions of categorical variables say coviartes c1 and c2 you can do something like

 

HAZARDRATIO c1 /  AT(c2=ALL) E;

 

Then, again, take the coefficients to a CONTRAST statement.  See the Syntax => HAZARDRATIO Statement section of the PHREG documentation for more details on the HAZARDRATIO Statement

Wafflecakes
Calcite | Level 5
The E option does not work I don't think when used in conjunction with the 'UNITS' option. how does this:

"If it doesn't work seamlessly you can always do the HAZARDRATIO/CONTRAST statement construct for UNITS=1 and then just manually exponentiate the resulting 1-unit hazard ratio (say HR_1) for UNITS=k as HR_k = (HR_1)**k."

Get you the p-value?
OsoGris
SAS Employee

I think the best thing to do at this point is to open up a ticket (Tracking Number) with SAS Technical Support.  You can do so by emailing to support@sas.com and make sure you reference PHREG in the subject.   However, the most efficient way to open a ticket is to use our online Submit A Problem form and select SAS/STAT from the  "Product" list (you'll have to scroll down in this list pretty far).   In so doing it is a good idea to provide your site number, SAS release and OS.   Please run the following SAS statement and include the results of which appear in the SAS log:       

 

         %put Site: &syssite    Release:  &sysver  (&sysvlong)    System: &sysscp (&sysscpl);

 

 

Wafflecakes
Calcite | Level 5

I do get the coefficients in these tables at the bottom but it is equal to the units that I set for the continuous variable and the other variables are listed as well with coefficients that equal 0.  Is that correct?  I don't think so?

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 8 replies
  • 4251 views
  • 0 likes
  • 2 in conversation