rssunt.gif (12308 bytes)


Creation date: 05/12/98
Authored by:
Rich Herrington

Question:

How do I perform simple main effects analysis using SAS or SPSS?

SAS
SPSS

Answer:

In SAS release 6.11 or higher:

PROC GLM ;
CLASS A B ;
MODEL Y = A B A*B ;
LSMEANS A*B / SLICE=B ;

TOP | BACK | MAIN

Additional Example:

/*An example of a three-way ANOVA using the slice option to get simple effects. The following */
/*data set is simulated using the random number generator function, RANNOR. */

data a;
do a= 1 to 3;
  do b= 1 to 2;
   do c = 1 to 2;
    do rep=1 to 20;
   int=rannor(123);
   y=int+(3*a)+(6*b)+(1.5*c)+(4.2*a*b)+(3.1*a*c)+(1.8*b*c)+(4.01*a*b*c)+ rannor(456);
output;
end;
end;
end;
end;

proc print;
run;


proc glm data=a;
class a b c;
model y= a|b|c ;
lsmeans a*b /slice=b;           /*A within the levels of B*/
lsmeans a*c /slice=c;           /*A within the levels of C*/
lsmeans a*b*c/slice=b*c pdiff;  /* A  within the levels of B*C*/
lsmeans a*b*c/slice=c pdiff;    /* A*B  within the levels of C*/
run;

TOP | BACK | MAIN

In SPSS, you can use the MANOVA procedure:

MANOVA Y BY A(1,2) B(1,2)

 

See also:

How to Test Contrasts in Repeated Measures Designs

How to Test Contrasts in Simple Mixed Models (One Within Subjects and One Between Subjects Effect) (Under Construction)

 

 


TOP | BACK | MAIN

Last updated: 01/18/06 by Craig Henderson