Programming the statistical procedures from SAS

GLIMMIX questions

Frequent Contributor
Posts: 92

GLIMMIX questions



I've a GLIMMIX question in terms of how to specify the random effect. Specifically I've three-level data, with students nested in school, then schools nested in regions. And I've three level-1 variables and two level-2 variables - and level 2 variables are especially of interest. A random intercept model for level 2 and level 3 would do. Random intercept and random slope model is ideal. My outcome variable is not linear, so I used Gamma distribution with link=log.


What confused me is how I should let SAS know which variable are level 2 variables? What variables are for identifying different levels (StudentID, SchoolID, GeoID) in the random statement. How do I use the random statement to indicate levels? Where do I put the level 2 variables - if I assume 1) fix slope, or 2) random stlop. 


I was told I have to have 3 RANDOM statement: /GeoID, then subject=SchoolID(GeoID), then subject=StudentID(SchoolID, GeoID), as below (but the model wouldn't run as it won't converge or ran out of memory), corrrect?


proc glimmix data=mydata  METHOD=LAPLACE NOCLPRINT;
    class PatientID HospID GeoID L1_var1 L1_var2 L1_var3 /*level 1 categorical vars*/ L2_var1 /*level 2 categorical vars*/
    model Y = L1_var1 L1_var2 L1_var3 /*level 1 variables*/ L2_var1 L2_var2  /*level 2 variables*/

              /dist= gamma link=log solution;
    random intercept / subject = GeoID type=un solution;
    random intercept / subject = SchoolID (GeoID) type=un solution;
    random intercept / subject = StudentID(SchoolID GeoID) type=un solution;


What's the differences when I just have

RANDOM intercept /Subject=GeoID; RANDOM intercept /Subject=SchoolID(GeoID), or

RANDOM intercept /Subject=GeoID; RANDOM intercept Subject=SchoolID


If I want to assume random slope for level 2 variables, do I just 

RANDOM intercept /Subject=GeoID;

RANDOM intercept L2_var1 L2_var2 / Subject=SchoolID



Sorry for those very basic GLIMMIX questions. Any reply is appreciated.Thanks.


Ask a Question
Discussion stats
  • 0 replies
  • 1 in conversation