data factor02; input a b wt; cards; 1 1 104 2 2 103 1 2 91 1 3 94 2 2 104 1 1 104 1 3 93 2 3 92 2 1 101 2 2 104 2 3 89 1 1 107 1 2 93 1 2 99 2 1 102 2 2 98 1 3 86 2 1 101 1 2 97 1 1 106 2 3 86 ; proc glm data=factor02; classes a b; model wt = a b a*b/xpx solution; lsmeans a b a*b/stderr pdiff e; contrast 'Factor A 1-2' a 1 -1/e; contrast 'Factor B 1-2,1-3' b 1 -1 0, b 1 0 -1/e; /* Estimates of fitted values for simple effects */ estimate ' A1 B1' intercept 1 a 1 0 b 1 0 0 a*b 1 0 0 0 0 0; estimate ' A1 B2' intercept 1 a 1 0 b 0 1 0 a*b 0 1 0 0 0 0; estimate ' A1 B3' intercept 1 a 1 0 b 0 0 1 a*b 0 0 1 0 0 0; estimate ' A2 B1' intercept 1 a 0 1 b 1 0 0 a*b 0 0 0 1 0 0; estimate ' A2 B2' intercept 1 a 0 1 b 0 1 0 a*b 0 0 0 0 1 0; estimate ' A2 B3' intercept 1 a 0 1 b 0 0 1 a*b 0 0 0 0 0 1; /* Estimates of some differences between simple effects */ estimate 'AB_11 - AB_12' b 1 -1 0 a*b 1 -1 0 0 0 0; estimate 'AB_11 - AB_13' b 1 0 -1 a*b 1 0 -1 0 0 0; estimate 'AB_21 - AB_22' b 1 -1 0 a*b 0 0 0 1 -1 0; estimate 'AB_21 - AB_23' b 1 0 -1 a*b 0 0 0 1 0 -1; estimate 'AB_11 - AB_21' a 1 -1 a*b 1 0 0 -1 0 0; estimate 'AB_12 - AB_22' a 1 -1 a*b 0 1 0 0 -1 0; estimate 'AB_13 - AB_23' a 1 -1 a*b 0 0 1 0 0 -1; run; quit;