* create dataset called wide, based on data from Keppel ; * each record has the data for one subject; * 8 subjects (sub) ; * 1 between subjects IV with 2 levels (group) ; * 1 within subjects iv with 4 levels (indicated by position dv1-dv4) ; * 1 dependent measure ; Data Wide; input sub group dv1 dv2 dv3 dv4; cards; 1 1 3 4 7 3 2 1 6 8 12 9 3 1 7 13 11 11 4 1 0 3 6 6 5 2 5 6 11 7 6 2 10 12 18 15 7 2 10 15 15 14 8 2 5 7 11 9 ; Run;* show how to get anova for mixed design using proc glm ; proc glm data=wide; class group; model dv1-dv4 = group; repeated trial 4; run;
* create dataset narrow, based on wide to use with proc mixed ; * each record has the data for ONE OBSERVATION; * 8 subjects (sub) ; * 1 between subjects IV with 2 levels (group) ; * 1 within subjects iv with 4 levels (trial) ; * 1 dependent measure (dv) ; Data Narrow; Set Wide; dv = dv1; trial = 1; output; dv = dv2; trial = 2; output; dv = dv3; trial = 3; output; dv = dv4; trial = 4; output; Run;
* show how to get anova for mixed design using proc mixed; proc mixed data=Narrow; class sub group trial; model dv = group trial group*trial; repeated trial / subject = sub type=cs; run;