Hello everyone, I have a question about how to get categorical variables RR estimates in PROC GENMOD. My outcome is a binomial variable (death), which 1= event happened, 0=event didn't happen. I listed 3 variables (x, y, z) as exposures that I am looking for to get their RR estimate in the PROC GENMOD procedure. All 3 variables are categorical, x has 5 categories, y has 2 categories, z has 5 categories. There is no missing value among those 4 variables. I found a PROC GENMOD tutorial from this link: https://stats.idre.ucla.edu/sas/faq/how-can-i-estimate-relative-risk-in-sas-using-proc-genmod-for-common-outcomes-in-cohort-studies/ The code I used is: proc genmod data = test;
class x (ref="1")/param=ref;
class y (ref="1")/param=ref;
class z (ref="1")/param=ref;
model death (event="1") = x y z/ dist=binomial link=log;
estimate 'Beta_x' x 1 -1/exp;
estimate 'Beta_y' y 1 -1/exp;
estimate 'Beta_z' z 1 -1/exp;
run; With the above code, I have this output. Although you can see the estimates don't show for different categories of x and z. I searched for other solutions. Then I found this solution: https://communities.sas.com/t5/Statistical-Procedures/RR-estimates-using-proc-Genmod-for-categorical-variables/m-p/549129#M27406 link to this website: https://support.sas.com/kb/23/003.html So I tried to use LSMEANS, the below code is I modified to get categorical variables RR estimates. proc genmod data = test;
class x (ref="1")/param=ref;
class y (ref="1")/param=ref;
class z (ref="1")/param=ref;
model death (event="1") = x y z/ dist=binomial link=log;
lsmeans x z / diff exp cl; /*I only added this line comparing to the code above*/
estimate 'Beta_x' x 1 -1/exp;
estimate 'Beta_y' y 1 -1/exp;
estimate 'Beta_z' z 1 -1/exp;
run; Although nothing new results showed up with this code, SAS generated the same results as the first screenshot I attached. Also, with the following Note and Warning: I am not sure if I used LSMEANS in the right way. Also, I wanted to ask what "1 -1" stands for in "estimate 'Beta_x 1 - 1/ exp"? I have seen some tutorial shows "1 -1" or "1" or "0 1 -1", but I don't really understand the function of it. If there are some tutorials I should know before doing this code, I would love to know about them! I appreciate your help!
... View more