Here's a brief example of writing a CONTRAST or ESTIMATE when a random effect is involved:
proc glimmix data=test;
class a trt;
model y=trt x1 x2 x3 / s dist=bin link=logit ;
random intercept / subject=a s;
estimate 'diff a2-a3' | int 1 / subject 0 1 -1;
run;
Use the vertical bar to indicate that everything following represents the random effects in the model. If you have a SUBJECT= identifier on the RANDOM statement, then use the forward slash and the SUBJECT keyword on the ESTIMATE statement to identify the subject coefficients you want to use. The example here compares levels 2 and 3 of effect A.
Wow that's indeed interesting! That means with my code having a 3x3 cov matrix and a intercept (see picture), I can test whether my 7 variances are simultaneously equal to 0 or my 7th variance (i.e. the intercept of ID) equals 0.
PROC GLIMMIX DATA = ...;
Please don't bother with different naming - it's basically the same.
Unfortunately with two random statements I get an error for the the estimate statement:
"Contrasts between subjects require that all random effects have the same subject; the CONTRAST statement is ignored."
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.