BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
obrienfk
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

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

View solution in original post

2 REPLIES 2
SteveDenham
Jade | Level 19

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

obrienfk
Calcite | Level 5

Thanks so much for the help. That all makes sense.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1788 views
  • 0 likes
  • 2 in conversation