BookmarkSubscribeRSS Feed
sclaire
Calcite | Level 5

Hello!

 

I am running a log binomial regression to predict relative risk of an outcome occurring (let's say Y, 0=absent, 1=present) based on a predictor (X with nominal categories 1, 2, 3, and 4). Most coding suggestions show how to do log binomial regression with a binomial predictor (not multicategorical predictor), but I want to compare RR of classes 2-4 to reference class 1. I tried the code below, but the mean estimates in the output don't entirely make sense based on my earlier ANVOA and odds ratio results. Any suggestsions?

 

TITLE 'UNADJUSTED X predicting Y';
proc genmod data = dataname;
CLASS X (ref="1" param=ref);
MODEL Y (event="1")= X/ dist = binomial link = log;
estimate 'Class 2' X 1/ exp;

estimate 'Class 3' X 2/ exp;

estimate 'Class 4' X 3/ exp;

run;

5 REPLIES 5
PaigeMiller
Diamond | Level 26

I don't know what your concerns are about the mean estimates, you haven't given any specifics or details, other than they don't match the ANOVA (and I would NOT expect them to match).

 

In PROC GENMOD, you don't need ESTIMATE statements to compute means, the LSMEANS statement gets the job done, and produces the proper error estimates.

--
Paige Miller
sclaire
Calcite | Level 5

Thanks for the response! I am wondering if the end of my code (the estimate lines) will return what I am looking for, the RR of classes 2-4 compared to class 1 as the reference group. The reason I was unsure was because these results are not in the same direction as the ANOVA + OR. Class 1 has comparatively low % of the event occurring in the raw data yet the RR do not come out that way (even when I specify "descending").

 

That said, LSMEANS will give me the RR as well? Thanks again!

PaigeMiller
Diamond | Level 26

That depends. What does RR stand for?

 

LSMEANS will allow you to compare the means of the different groups.

--
Paige Miller
sclaire
Calcite | Level 5

Risk ratio (RR) instead of odds ratio (OR)

PaigeMiller
Diamond | Level 26

That said, LSMEANS will give me the RR as well? Thanks again!

While I do have plenty of other experience with PROC GENMOD, but I have never done a log binomial regression, I give you this brilliant answer: try it and see.

--
Paige Miller

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3121 views
  • 1 like
  • 2 in conversation