* Data from a completely randomized factorial design ; data one ; input a b n ; do i = 1 to n ; input y @@ ; output ; end ; cards ; 1 1 5 24 33 37 29 42 1 2 5 44 36 25 27 43 1 3 5 38 29 28 47 48 2 1 5 30 21 39 26 34 2 2 5 35 40 27 31 22 2 3 5 26 27 36 46 45 3 1 5 21 18 10 31 20 3 2 5 41 39 50 36 34 3 3 5 42 52 53 49 64 ; proc glm ; class a b ; model y = a b a*b ; lsmeans a*b / slice = b ; contrast 'B*psi1(A) interaction' a*b 1 0 -1 -1 0 1 0 0 0, a*b 0 1 -1 0 -1 1 0 0 0 ; contrast 'B*psi2(A) interaction' a*b .5 0 -.5 .5 0 -.5 -1 0 1 , a*b 0 .5 -.5 0 .5 -.5 0 -1 1 ; estimate 'main effect A1 -A2' a 3 -3 0 a*b 1 1 1 -1 -1 -1 0 0 0 / divisor = 3 ; contrast 'main effect A1 -A2' a 1 -1 0 a*b .333 .333 .334 -.333 -.333 -.334 0 0 0 ; lsmeans a / pdiff ; lsmeans a / pdiff adjust = tukey ; output out = two predicted = py ; run ; * proc print ; run ; proc plot vpercent = 80 ; plot py*a=b py*b=a ; run ;