Dear All:
I tried to report two risk ratios for the two levels of a modifier (retirement: 1 yes and 0 no). The exposure variable is depression (1: depressed and 0:not). I made the following SAS syntax:
proc genmod data=abc desc;
class dep retire /param=ref ref=first;
model death = dep retire dep*retire /dist=bin link=log;
estimate "RR in Non_retired" dep 1 dep*retire 0/exp;
estimate "RR in Retired" dep 1 dep*retire 1/exp;
run;
However, the two risk ratios used two reference groups. The risk ratio among non-retired has a reference of risk among subjects who were not retired and not depressed. In the second group (RR in the retired group), the reference risk is subjects who were retired but not depressed. I want to estimate the two risk ratios by using the same reference in the non-retired category but do not know how to use the 'estimate' option. Great appreciate it if you would help me. Thanks!
This simply treats the risk in one of the four combinations of DEP and RETIRE as a reference (denominator) and compares it to each of the other three combinations. These (and all other possible comparisons among the combinations) are provided by the first LSMEANS statement I showed. Using the DEP=0 and RETIRE=0 as that reference combination, they are the ones with _DEP=0 and _RETIRE=0.
While I just can't understand what you are really trying to do, you can make this easier on yourself, by using LSMEANS. As I've said here many times, you should never use the more complex ESTIMATE (or CONTRAST) statement when simpler statements can do the job. The LSMEANS statement requires using the nonfull-rank version of reference parameterization which is the default GLM parameterization.
From the first LSMEANS statement below, you get the estimated event probability (presumably the probability of death) in the MEAN column (provided by the ILINK option) for each combination of DEP and RETIRE. In the Differences table, you also get (in the Exponentiated column) every pairwise comparison which includes (if that's what you want) the relative risk of death comparing DEP levels in each level of RETIRE. If you want is a single, common relative risk estimate across the levels of RETIRE (probably not advisable if the interaction is significant) then the second LSMEANS statement provides that in the Exponentiated column of the Differences table. The E option shows how it is constructed, which by default treats the RETIRE levels in a balanced way. You can use the OM option in the LSMEANS statement if the RETIRE levels are not balanced.
proc genmod desc;
class dep retire/ref=first;
model death=dep|retire/d=b link=log;
lsmeans dep*retire/ilink diff exp;
lsmeans dep / ilink diff exp e;
run;
Thank you for your reply!
To explain how one variable modifies the other, I need to estimate a risk ratio for each level of the modifier. In other words, I need to estimate one risk ratio at the level of retire=1 and the other risk ratio at the level of retire=0, but use the same references (i.e., the group who had exposed neither of the two variables). This is recommended by this paper (Table 6 on page 48).
https://www.hsph.harvard.edu/wp-content/uploads/sites/603/2018/04/InteractionTutorial_EM.pdf
The SAS syntax that I made estimated the two risk ratios using two different reference groups (Table 5 on the same page).
Would you help me in this regard?
Thanks again!
By the way, this is what I need:
This simply treats the risk in one of the four combinations of DEP and RETIRE as a reference (denominator) and compares it to each of the other three combinations. These (and all other possible comparisons among the combinations) are provided by the first LSMEANS statement I showed. Using the DEP=0 and RETIRE=0 as that reference combination, they are the ones with _DEP=0 and _RETIRE=0.
Many thanks. The issue has been solved. Hongjie
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.