i am wondering either i add "CLASS" statement or not.
i am trying to run Cox-regression model, so i made this code.
and what i need is the hard ratios for outcome on exposure.
exposure(0=no exposure, 1= yes exposure) and outcome(0=no outcome, 1= yes outcome) variable are all binary.
Can i add class statement to want to see hazard ratios on exposure
proc phreg data=episode;
/*class exposure*/
model period*outcome(0)=exposure / rl;
run;
My output is per individual,
1) class statement
DF
1 | Parameter Estimate -1.45709 | Standard Error
0.15452 | Chi-Square
88.9231 | Pr > ChiSq <.0001 | Hazard Ratio 0.233 | 95% Hazard Ratio
0.172 | ConfidenceLimit
0.315 |
2) non class statement
DF | Parameter Estimate | Standard Error | Chi-Square | Pr > ChiSq | Hazard Ratio | 95% Hazard Ratio | ConfidenceLimit |
1 | 1.45709 | 0.15452 | 88.9231 | <.0001 | 4.293 | 3.172 | 5.812 |
Hello @MTeck and welcome to the SAS Support Communities!
In the case of a dichotomous explanatory variable with values 0 and 1 (like exposure in your data) the results with vs. without a CLASS statement are essentially the same. However, it can happen (and it did in your example) that the CLASS statement uses level '1' of that explanatory variable as the reference level so that the sign of the corresponding parameter estimate changes and the inverse hazard ratio and confidence limits are computed, here: the hazard ratio of "no exposure" vs. "exposure."
I would use the CLASS statement (because exposure is a classification variable) and explicitly specify the reference level so that the intended results are clear. If variable exposure is not formatted:
class exposure(ref='0');
If variable exposure is formatted and the formatted value of exposure=0 is 'no':
class exposure(ref='no');
Or, to avoid hardcoding of formatted values:
class exposure(ref=first) / order=internal;
(Among the internal values of exposure, 0 and 1, 0 is the first, regardless of formats. See the documentation for more details.)
Hello @MTeck and welcome to the SAS Support Communities!
In the case of a dichotomous explanatory variable with values 0 and 1 (like exposure in your data) the results with vs. without a CLASS statement are essentially the same. However, it can happen (and it did in your example) that the CLASS statement uses level '1' of that explanatory variable as the reference level so that the sign of the corresponding parameter estimate changes and the inverse hazard ratio and confidence limits are computed, here: the hazard ratio of "no exposure" vs. "exposure."
I would use the CLASS statement (because exposure is a classification variable) and explicitly specify the reference level so that the intended results are clear. If variable exposure is not formatted:
class exposure(ref='0');
If variable exposure is formatted and the formatted value of exposure=0 is 'no':
class exposure(ref='no');
Or, to avoid hardcoding of formatted values:
class exposure(ref=first) / order=internal;
(Among the internal values of exposure, 0 and 1, 0 is the first, regardless of formats. See the documentation for more details.)
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.