options nocenter ls=80; goptions colors=(none); data example1; input trt x y @@; z1 = 0; z2 = 0; if trt = 1 then z1 = 1; if trt = 2 then z2 = 1; cards; 1 1.2 7 1 1.9 13 1 3.4 16 2 4.0 20 2 5.2 22 2 5.8 32 3 7.7 31 3 8.3 45 3 8.9 42 ; proc sort; by trt; symbol1 v=circle; symbol2 v=square; symbol3 v=triangle; proc gplot; plot y*x=trt; proc glm; class trt; model y=trt; means trt / tdiff lsd; proc glm; class trt; model y=trt x; lsmeans trt / tdiff adjust=t; proc reg; model y = x z1 z2; /* z1 coef is diff between adj means of trt 1 vs 3 z2 coef is diff between adj means of trt 2 vs 3 Coef z1 minus coef z2 is diff between trt 1 vs 2 The test command can be used to test hypotheses */ trt1vs3: test z1=0; trt2vs3: test z2=0; trt1vs2: test z1-z2=0; data example2; input trt x y @@; cards; 1 1.2 7 1 1.9 13 1 3.4 16 2 4.0 6 2 5.2 13 2 5.8 14 3 7.7 7 3 8.3 13 3 8.9 15 ; proc glm; class trt; model y=trt; proc glm; class trt; model y=trt x; lsmeans trt / tdiff adjust=tukey; /* With GLM, do not need to define interaction as a variable prior to doing analysis */ proc glm data=example1; class trt; model y=trt x trt*x; lsmeans trt / tdiff; run; quit;