Hi All,
I'm specifying some custom hazard ratios in a Cox PH reg model with multiple 2-way interaction terms and as a sanity check, I'm comparing some of the results I get from the HAZARDRATIO statement to the CONTRAST statements I specify.
The problem is, these results aren't matching up. Below is some example code, the data, and the output:
The data:
data WORK.SURVIVALDATA;
infile datalines dsd truncover;
input YEARDX:BEST. SURV_MON_ACT:BEST. BELOW200CTACS2011:BEST. CHRLSON:BEST. race_r:32. sex_r:32. agecatt:32. vitstat_r:32. urbanrural:32.;
datalines;
2010 0 42.2 8 1 1 4 0 0
2015 10 15.2 5 1 1 3 0 0
2014 3 66.2 3 1 2 4 0 1
2010 69 43.1 2 1 2 4 0 0
2012 3 63.2 0 1 1 4 0 0
;;;;
run;
The code:
proc phreg data=survivaldata;
class race_r sex_r urbanrural agecatt;
strata yeardx agecatt;
model surv_mon_act*vitstat_r (1)= sex_r chrlson race_r below200ctacs2011 urbanrural agecatt agecatt*below200ctacs2011 below200ctacs2011*race_r agecatt*race_r/type1;
format sex_r gender.;
format race_r racefmt.;
contrast 'Hispanic vs. Non-Hispanic White at below200ctacs2011=10 and agecatt=1' race_r 0 1 0 below200ctacs2011 10 agecatt 1 0 0 agecatt*below200ctacs2011 10 0 0 below200ctacs2011*race_r 0 10 0 agecatt*race_r 0 0 0 1/e estimate=exp;
hazardratio race_r/cl=wald at (below200ctacs2011=10);
where surv_mon_act ne 9999;
run;
From the hazardratio statement (HR 95% CI):
From my contrast statement:
Based on this, I was wondering two things:
1. Is this happening because my CONTRAST statement syntax is wrong or because of a difference in how the HAZARDRATIO and CONTRAST statements calculate the HR's? (I use SAS 9.4 FWIW)
2. If I wanted to calculate 'Hispanic vs. Non-Hispanic White at BELOW200CTACS2011=10' (with equal distribution of weights among the other interaction terms) how would I change the CONTRAST statement accordingly?
If you add the E option in the HAZARDRATIO statement, like you did in the CONTRAST statement, you'll be able to see the coefficients of the linear combination of parameters that the HAZARDRATIO statement used and compare that to what you specified in the CONTRAST statement. See, for example, this note.
If you add the E option in the HAZARDRATIO statement, like you did in the CONTRAST statement, you'll be able to see the coefficients of the linear combination of parameters that the HAZARDRATIO statement used and compare that to what you specified in the CONTRAST statement. See, for example, this note.
Thank you so much! For most people with this issue, and my first question, I think this is all they'll need.
However, to rephrase and restate my second question, if I were to calculate 'Hispanic vs. Non-Hispanic White at BELOW200CTACS2011=10' (with equal distribution of weights among agecatt), would it make sense to write it like this?
contrast 'Hispanic vs. Non-Hispanic White at below200ctacs2011=10' race_r 0 1 0 below200ctacs2011*race_r 0 10 0 race_r*agecatt 0 0 0 0.25 0.25 0.25/e estimate=exp
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.