%newsas(3wayex); /*-------------------------------------------------* | Three-Way Anova Design | | Effects of linguistic activity during retention | | and type of material learned on forgetting. | *-------------------------------------------------*/ title '3-Way ANOVA: Linguistic activity during retention'; Proc Format; Value Bfmt 1='Low' 2='Med' 3='High' ; Value Cfmt 1='Minimum' 2='Maximum'; /* The data given by Keppel consist of cell sums. Generate raw data (N=15 per cell) consistent with the given data. */ data recallm; Label A='Retention Interval (hours)' B='Material' C='Activity' ; Drop sum; Input A B C SUM; mean = sum / 15; datalines; 1 1 1 205 1 2 1 210 1 3 1 208 4 1 1 198 4 2 1 193 4 3 1 197 7 1 1 182 7 2 1 177 7 3 1 179 1 1 2 209 1 2 2 203 1 3 2 211 4 1 2 178 4 2 2 182 4 3 2 197 7 1 2 146 7 2 2 169 7 3 2 182 ; *-- Create equivalent 'raw' data set with MSE=1.49; %stat2dat(data=recallm, out=recall, depvar=Y, label=Words Recalled, mean=mean, n=15, freq=N, mse=1.49); proc glm data=recall; Class A B C; freq N; Model Y = A | B | C / ss3; *contrast 'A linear' A -1 0 1; *contrast 'A quadratic' A 1 -2 1; contrast %poly(3,1,A); *-- linear; contrast %poly(3,2,A); *-- quad; *contrast 'A-lin x C' A*C -1 1 0 0 1 -1; *contrast 'A-quad x C' A*C 1 -1 -2 2 1 -1; contrast %inter(A,3,1, C,2,1); contrast %inter(A,3,2, C,2,1); lsmeans A*B*C / slice=C; run; *-- Treat A as quantitative (regression) variable; title2 'A as a quantitative variable'; proc glm data=recall; Class B C; freq N; Model Y = A | B | C / ss3; run; /*------------------------------------------------------------* | find means, sums, stderrs for each combination of A, B & C | *------------------------------------------------------------*/ title2; Proc Summary data=recall; CLASS A B C; Var Y; freq N; Output out=means mean=YBAR sum=SUM stderr=STDERR; Proc Print; Id _TYPE_; by _TYPE_; run; %include goptions; axis2 order=(1 to 7 by 3); title 'Linguistic activity during retention: A * B * C means'; %meanplot(data=recall, response=Y, class=A B C, freq=N, haxis=axis2, pmean=no, pfmt=Cfmt., cfmt=Bfmt.); axis1 order=(11 to 14) label=(a=90); title 'Linguistic activity during retention: A * C effect'; %meanplot(data=recall, response=Y, class=A C, freq=N, vaxis=axis1, haxis=axis2, cfmt=Cfmt.); title 'Linguistic activity during retention: B * C effect'; %meanplot(data=recall, response=Y, class=B C, freq=N, vaxis=axis1, xfmt=Bfmt., cfmt=Cfmt.);