BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
joebacon
Pyrite | Level 9

Hi everyone. I am trying to teach myself about Proc Genmod/Proc Glimmix and the intricacies of higher level models. I am using online resources almost primarily and ran into some walls. I was hoping this forum would help me get some more information or know what to look into to help myself.

 

This is a multilevel analysis to look at whether trial retention (RETENTION) is predicted by intervention condition (CONDITION), attendance at an orientation session (IMPLEMENTATION), controlling for study intervention group – there were 8 of these (STUDYGROUP).

 

I am working through some code and figured out how to do a two-level model, but I want to add one more layer.

 

procgenmoddata=AOOF.INTACT_LONGdescending;

 class ID visit(desc) CONDITION (desc) IMPLEMENTATION (desc);

 model RETENTION = visit CONDITION IMPLEMENTATION/dist=binomiallink=logtype3;

 repeatedsubject=id;

run;

I’ll need to add an additional level of STUDYGROUP. I was reading a few different things and one of the ways I could handle this was using GEE framework something like:

 
proc genmod data=AOOF.INTACT_LONG descending;
  class ID visit(desc) CONDITION (desc) IMPLEMENTATION (desc)STUDYGROUP;
  model RETENTION = visit CONDITION IMPLEMENTATION CONDITION*IMPLEMENTATION /dist=binomial link=log type3;
  repeated subject=id(studygroup);
  lsmeans CONDITION*IMPLEMENTATION /  exp CL ilink;
run;
I can't seem to find a way to get the following which I believe to be the main reporting statistics usually for this type of model (please forgive me if I'm being ignorant or looking over something):

            -adjusted estimates, CIs

            -estimated differences

            -ORs with  CI

 

How would I achieve these or are there other main reporting statistics that I am overlooking?

 

One other question I had was how exactly do you represent a nested structure in genmod?  I want to model repeated measures for people who are within study groups for one outcome (retention). For another outcome (attendance) there isn’t a repeated measure but people are still without study group.

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

You have an LSMEANS statement, with exp, CL and ilink options.  You should add a diff option on there, and I think you will get what you are looking for.

 

The other question raises some theoretical issues - do you want marginal responses (averaged over the random effects) or conditional responses (values conditional on the random estimates)?  For the first, look at PROC GEE (or try PROC GENMOD with a REPEATED statement).  For the latter, use PROC GLIMMIX.  There you would have two RANDOM statements - the first would cover any clustering variables while the second would cover the repeated variable.  And then you have to decide whether to make that variable R-side (residual option) or G-side.  

 

I would really recommend getting a copy of Walt Stroup's book: Generalized Linear Mixed Models: Modern Concepts, Methods and Applications.  It has a lot of really good examples in SAS and covers both applied and theoretical considerations.

 

SteveDenham

View solution in original post

4 REPLIES 4
SteveDenham
Jade | Level 19

You have an LSMEANS statement, with exp, CL and ilink options.  You should add a diff option on there, and I think you will get what you are looking for.

 

The other question raises some theoretical issues - do you want marginal responses (averaged over the random effects) or conditional responses (values conditional on the random estimates)?  For the first, look at PROC GEE (or try PROC GENMOD with a REPEATED statement).  For the latter, use PROC GLIMMIX.  There you would have two RANDOM statements - the first would cover any clustering variables while the second would cover the repeated variable.  And then you have to decide whether to make that variable R-side (residual option) or G-side.  

 

I would really recommend getting a copy of Walt Stroup's book: Generalized Linear Mixed Models: Modern Concepts, Methods and Applications.  It has a lot of really good examples in SAS and covers both applied and theoretical considerations.

 

SteveDenham

SteveDenham
Jade | Level 19

See other posts in this community by @StatDave  regarding macros to get differences and CL's on the original scale.  My mind has been greatly expanded today.

 

SteveDenham

joebacon
Pyrite | Level 9

Steve,

Thank you for taking the time to suggest some literature and help with my model. I ended up going with Genmod with a repeated statement and the diff option. I have the book ordered and will definitely give it a read- it looks to have good reviews across the board.

 

Thanks again,

Joe

StatDave
SAS Super FREQ

GENMOD cannot be used for multilevel models. It does not allow for random effects. See this note regarding nested correlation structures. The SUBJECT= effect is not part of the model specification - it is only used to determine which observations are in a cluster. 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is ANOVA?

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.

Discussion stats
  • 4 replies
  • 735 views
  • 1 like
  • 3 in conversation