Hi all,
I'm racking my brains trying to do a Factorial Repeated Measures ANOVA; something that I was able to do easily on SPSS (the new lab I've moved to uses SAS). I found a similar discussion to this on these treads, but it was never really concluded.
I have three IVs, one is an independent group with two levels ("teen" and "adult") while the other two are repeated measures IVs with two levels each (Time: "0 Months" and "12 Months"; Task: "Task A" and "Task B".) So just to be clear, each of my participants belonged to one of two groups, but all participants completed task A and task B at 0 Months and 12 Months.
I've found in the SAS documentation (and on other websites) how to conduct an ANOVA where one variable is a repeated measures one while the other variables are independent groups; it seems to be possible to do it in PROC GLM or PROC MIXED. However, I cannot see how to alter this syntax so as to incorporate an additional repeated measures variables; and to look at the interaction between the two repeated measures variables, i.e. I'd like to be able to say whether the difference between performance on task A and B is different at each time point.
If I was just using one repeated measures variable (e.g. Time), I'd use the following code:
PROC GLM DATA=MyData;
CLASS Age_Group;
MODEL Time1-Time2 = Age_Group;
REPEATED Time 2;
RUN;
...but I can't see how to alter this to include another repeated measures IV. Is it the case that PROC GLM can only handle one Repeated Measures variable at a time and that I need to turn to PROC MIXED to do this?
Hope the above makes sense!
Fearghal
Yes, you need to move to PROC MIXED. See the part of the documentation under the REPEATED statement for Kronecker products in the type= option. With two times and two tasks, your code would look something like;
proc mixed data=yourdata;
class time task age_group subjid;
model response_variable=time|task|age_group;
repeated task age / type = UN@UN subject=subjid;
lsmeans time|task|age_group/diff cl;
run;
Be sure that yourdata is in 'long' form, with one record having a unique combination of values of time, task, age_group and subjid for each observation of response_variable.
Steve Denham
Yes, you need to move to PROC MIXED. See the part of the documentation under the REPEATED statement for Kronecker products in the type= option. With two times and two tasks, your code would look something like;
proc mixed data=yourdata;
class time task age_group subjid;
model response_variable=time|task|age_group;
repeated task age / type = UN@UN subject=subjid;
lsmeans time|task|age_group/diff cl;
run;
Be sure that yourdata is in 'long' form, with one record having a unique combination of values of time, task, age_group and subjid for each observation of response_variable.
Steve Denham
Thanks so much for the help. That all makes sense.
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 how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.