options ls=75; data one; /*Columns are fieldlicate, pesticide type, irrigation (1=yes, 2=no) ) variety, and yield. ) "%lf %lf %lf %lf %lf"*/ input field pest irr cv y; *trt = irr+cv/10; if (irr=1) and (cv=1) then trt=1; else if (irr=1) and (cv=2) then trt=2; else if (irr=2) and (cv=1) then trt=3; else if (irr=2) and (cv=2) then trt=4; cards; 1 1 1 1 53.4 1 2 1 1 54.3 1 3 1 1 55.9 2 1 1 1 46.5 2 2 1 1 57.2 2 3 1 1 57.4 1 1 1 2 53.8 1 2 1 2 56.3 1 3 1 2 58.6 2 1 1 2 51.1 2 2 1 2 56.9 2 3 1 2 60.2 1 1 2 1 58.2 1 2 2 1 60.4 1 3 2 1 62.4 2 1 2 1 49.2 2 2 2 1 61.6 2 3 2 1 57.2 1 1 2 2 59.5 1 2 2 2 64.5 1 3 2 2 64.5 2 1 2 2 51.3 2 2 2 2 66.8 2 3 2 2 62.7 ; run; *goptions colors=(black) device=psepsf; axis1 value=(height=3) offset=(5); symbol1 value=1; symbol2 value=2; symbol3 value=3; proc gplot; plot y*pest/haxis=axis1; plot y*pest=trt/haxis=axis1; plot y*trt=pest/haxis=axis1; run; proc means noprint nway; class pest field; var y; output out=two mean=mean; run; proc print;run; proc glm; class pest; model mean=pest; means pest; run; /*proc glm; class field pest irr cv trt; *model y=irr|cv|pest field(trt); *model y=trt|pest field(trt); model y=trt|pest field(pest); *model y=irr|cv pest pest*irr*cv field(irr*cv); *test h=trt e=field(trt); test h=pest e=field(pest); *means trt pest; run; proc varcomp; class field pest irr cv trt; *model y=irr|cv|pest field(trt)/fixed=3; model y=trt|pest field(pest)/fixed=3; run; endsas;*/ /* PROC MIXED for split-plot analysis with trt as whole-plot factor and pest as split-plot factor */ /* proc mixed method=type3; class field pest irr cv trt; *model y=trt|pest; model y=irr|cv pest irr*cv*pest; *contrast "irr - notirr" trt 1 1 -1 -1; *contrast "cv2 - cv1" trt -1 1 -1 1; *contrast "interaction" trt -1 1 1 -1; random field(pest); *random field(irr*cv); *parms /nobound; *lsmeans trt /pdiff adj=tukey; *lsmeans irr*cv irr cv pest/pdiff; run; */