PROC MIXED DATA=have METHOD=REML EMPIRICAL; CLASS condition sex school baseline; MODEL score = condition timepoint_num condition*timepoint_num age sex school baseline / SOLUTION; REPEATED / TYPE=UN SUBJECT=patientid; QUIT;
To address the "over my head" concern, you might want to read the papers
Kiernan, Tao, and Gibbs (2012), "Tips and Strategies for Mixed Modeling with SAS/STAT procedures"
I'm nit an expert in mixed models, but in KTG (2012), on p. 3, there is an example similar to yours. The surrounding text seems to imply that since you did not put PATIENTID on the CLASS statement, that you should sort the data by PATIENTID and by the time-like variable (which might be timepoint_num???). So try this before the PROC MIXED step:
proc sort data=have;
by patientid timepoint_num; /* or whatever variable is used to order the repeated obs */
run;
Working from @Rick_SAS's surmission about your code, try the following:
PROC MIXED DATA=have METHOD=REML EMPIRICAL;
CLASS condition sex school baseline timepoint_num patientid;
MODEL score = condition timepoint_num condition*timepoint_num age sex school baseline / SOLUTION;
REPEATED timepoint_num / TYPE=UN SUBJECT=patientid;
RUN;
This will give you a medium inference space solution--broad for patients, narrow for schools. You might want to consider school as a random effect, in which case the following would be appropriate:
PROC MIXED DATA=have METHOD=REML EMPIRICAL;
CLASS condition sex school baseline timepoint_num patientid;
MODEL score = condition timepoint_num condition*timepoint_num age sex baseline / SOLUTION;
REPEATED timepoint_num / TYPE=UN SUBJECT=patientid;
RANDOM intercept/subject=school;
RUN;
For these to work, you need unique patientid's across all schools, and you need unique observations at each timepoint_num for each patientid.
Now comes the flood--how does your data breakdown? How many timepoint_num's are you trying to fit? Since they are indexed (presumably, based on the variable name), is the spacing relatively equal between them, and is it similar in number of timepoints across schools?
Besides the texts @Rick_SAS mentioned, get a copy of SAS for MIxed Models, 2nd ed. by Littell et al. (3rd ed. soon to be issued).
Steve Denham
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.