Hello. I am performing multiple mixed models using proc mixed in SAS version 9.4 for the first time. The original dataset was reshaped from a wide to long format. There are 336 participants total and repeated measures at baseline, 6 months, and 12 months. In the Results Viewer, the number of observations shows 1008 and the max obs per subject shows 1. How do I interpret or change the number of observations and max obs per participant? There are not 1008 individuals in the study.
Hi Lori,
You need to add studyID to the CLASS statement. Your code treats it as a continuous variable, so time is not blocked by subjectID. I think you will be much happier with the other results (R matrix, the covariance parameter estimates and standard errors) as well.
You probably ought to include the interaction between time and group in your model, and consider looking at the time*group lsmeans using the slice approach. This would enable you to test for differences between groups at each time point. Your current model assumes that differences between groups is identical at each time point.
If you want to test particular groups against one another at a particular time point, you have two options. In PROC MIXED, you would have to write several LSMESTIMATE statements. However, if you shifted to PROC GLIMMIX, you would have the advantage of the SLICEDIFF and SLICEDIFFTYPE options in the LSMEANS statement.
SteveDenham
However there are 1008 observations, so it appears that the blocking by subject isn't being accomplished. Could you share your PROC MIXED code? I suspect that you need a subject= option in the REPEATED statement.
SteveDenham
Thank you for replying to my post.
Here is my SAS code:
proc mixed data=projectlong2;
Class group time ;
Model wellbeing= group time;
Repeated time / Subject=studyID Type=UN R RCorr;
LSMeans group / PDiff cl;
RUN;
It looks like I do have the subject=option in the repeated statement but something is still not right.
Lori
Hi Lori,
You need to add studyID to the CLASS statement. Your code treats it as a continuous variable, so time is not blocked by subjectID. I think you will be much happier with the other results (R matrix, the covariance parameter estimates and standard errors) as well.
You probably ought to include the interaction between time and group in your model, and consider looking at the time*group lsmeans using the slice approach. This would enable you to test for differences between groups at each time point. Your current model assumes that differences between groups is identical at each time point.
If you want to test particular groups against one another at a particular time point, you have two options. In PROC MIXED, you would have to write several LSMESTIMATE statements. However, if you shifted to PROC GLIMMIX, you would have the advantage of the SLICEDIFF and SLICEDIFFTYPE options in the LSMEANS statement.
SteveDenham
Hi Steve,
Thanks so much! I added studyID to the class statement and it worked. I am happier with the results.
Thank you for the suggestions. I plan to include a two way and three way interaction (group by time by race) in the model. I would like to test specific groups against one another at different time points. There are four groups (3 treatment and 1 control). I will probably use several LSMESTIMATE statements. Am I on the right track (please see below)?
Here is an example of a partial code:
lsmeans group/ cl;
estimate group 1-1;
estimate group 1-2;
estimate group 1-3;
estimate group 1-4;
estimate group 2-4;
estimate group 3-4;
Lori
You will probably be happier using LSMESTIMATE statements than ESTIMATE statements as the LSMESTIMATE allows for multiple lines so you can apply adjustments for multiple comparisons.
SteveDenham
Ok, thank you. I will try that.
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 16. Read more here about why you should contribute and what is in it for you!
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.