- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You need to show us some output.
Show the result of LSMEANS without Control;
lsmeans Trt_Amend_App * Trt_CC / pdiff;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc format;
value fmt
1='X'
2='Y'
;
run;
and the value of Trt_CC variable is 1,2
Therefore,
'X' ,'Y' is the FORMATTED values.
1,2 is the internal values.