options nocenter ls=80; data example1; input fert sect plnt y @@; cards; 1 1 1 18 1 1 2 22 1 1 3 17 1 3 1 22 1 3 2 28 1 3 3 25 2 2 1 17 2 2 2 15 2 2 3 14 2 4 1 12 2 4 2 15 2 4 3 16 ; proc glm; class fert sect; model y = sect(fert) fert; random sect(fert) / test; data example2; input order subj period y @@; trt = 1; if order = 1 & period = 2 then trt = 2; if order = 2 & period = 1 then trt = 2; cards; 1 1 1 132 1 1 2 137 1 2 1 130 1 2 2 138 1 3 1 142 1 3 2 145 1 4 1 138 1 4 2 152 2 1 1 126 2 1 2 161 2 2 1 152 2 2 2 164 2 3 1 144 2 3 2 160 2 4 1 144 2 4 2 166 ; proc glm; class order subj period; model y = order subj(order) period period*order; random subj(order) / test; proc glm; class order subj period trt; model y = order subj(order) period trt; random subj(order) / test; data example3; input fert sect time y @@; cards; 1 1 1 18 1 1 2 22 1 1 3 17 1 3 1 22 1 3 2 28 1 3 3 25 2 2 1 17 2 2 2 15 2 2 3 14 2 4 1 12 2 4 2 15 2 4 3 16 ; proc glm; class fert sect time; model y = sect(fert) fert time fert*time; random sect(fert) / test; lsmeans fert*time / slice=time stderr; proc mixed; class fert sect time; model y = fert time fert*time; repeated time / subject=sect type=cs; proc mixed; class fert sect time; model y = fert time fert*time; repeated time / subject=sect type=ar(1); run; quit;