Using a mixed effects model in PROC GLIMMIX, I would like to determine the differences between lsmeans with a chosen control. I'm trying to mimic the method outlined in the documentation to the best of my ability, but I get an error indicating "cannot find control level".
proc glimmix data=df_y1 plots=studentpanel;
class Trt_Amend_App Trt_CC ID_S Block;
model Yield_Grain_Mg_ha = Trt_Amend_App | Trt_CC | ID_S / ddfm=kr2;
random Block(ID_S);
lsmeans Trt_Amend_App * Trt_CC / pdiff=control('7' '2') adjust=dunnett;
run;
The control corresponds to the 7th level of factor Trt_Amend_App and the 2nd level of Trt_CC. Any help clarifying this issue would be much appreciated.
If you have a format attached with these two variables( Trt_Amend_App Trt_CC ) ,you need to use their FORMATTED value ,not internal value.
Using PROC FREQ to check its value:
proc freq data=df_y1; table Trt_Amend_App * Trt_CC ; run;
If you have a format attached with these two variables( Trt_Amend_App Trt_CC ) ,you need to use their FORMATTED value ,not internal value.
Using PROC FREQ to check its value:
proc freq data=df_y1; table Trt_Amend_App * Trt_CC ; run;
Edited: There was an error in my factor level strings causing the issue. The code below works otherwise. Thanks.
Hey Ksharp - thank you for your response.
From running PROC FREQ, I see that I can easily see the level values, but I'm not sure exactly what you mean that I need to use their 'FORMATTED values'. PROC CONTENTS indicates that these factors are all type "char".
This code returned the same error, "cannot find control level for effect...":
lsmeans Trt_Amend_App * Trt_CC / pdiff=control('Control-Fert-nan' 'no_CC') adjust=dunnett;
You need to show us some output.
Show the result of LSMEANS without Control;
lsmeans Trt_Amend_App * Trt_CC / pdiff;
Hey now that I'm looking at it again, I appear to have made a error with my strings! So the problem is solved now. Thanks for your help.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.