options nocenter ls=75; data example1; input trt y @@; cards; 1 1.90 1 1.80 1 1.54 1 4.10 1 1.89 2 0.82 2 3.36 2 1.64 2 1.74 2 1.21 3 5.33 3 4.84 3 5.26 3 4.92 3 6.07 4 3.08 4 1.42 4 4.54 4 1.25 4 2.57 ; proc glm; class trt; model y=trt; contrast 'L' trt -1 1 -1 1; contrast 'E' trt -1 -1 1 1; contrast 'interaction' trt 1 -1 -1 1; data twoway; set example1; L=0; E=0; if trt=3 | trt=4 then E=1; if trt=2 | trt=4 then L=1; proc glm; class E L; model y=E L E*L; lsmeans L*E / stderr tdiff slice=E; proc glm; class E L; model y=E L E*L; random E L E*L / test; proc glm; class E L; model y=E L E*L; random L E*L / test; lsmeans E / tdiff stderr; lsmeans E / tdiff stderr E=E*L; proc mixed; class E L; model y=E; random L E*L; lsmeans E / diff; run; quit;