/* Example SAS code for unbalance two-way ANOVA */ Option ps=45 ls=80 nodate nonumber; DATA Math581.data1; input A B Y; TC=10*A+(B/5); /* this will code the treatment combinations 11, 12,..., 23 */ Lines; 1 5 .204 1 5 .170 1 10 .167 1 10 .182 1 10 .187 1 15 .202 2 5 .257 2 5 .279 2 10 .283 2 10 .235 2 10 .260 2 15 .256 2 15 .281 2 15 .258 ; Proc GLM; class A B; Model Y=A B A*B/ss3; LSMEANS A B / PDIFF=ALL CL ADJUST=TUKEY; Contrast '11-13-21+23' A*B 1 0 -1 -1 0 1; Contrast 'B1-B2' B 1 -1 0; run; Proc GLM; Class TC; Model Y=TC; LSMEANS TC/PDIFF=ALL CL ADJUST=TUKEY; Contrast '11-13-21+23' TC 1 0 -1 -1 0 1; Contrast 'B1-B2' TC 1 -1 0 1 -1 0; run; Proc SORT; By A B; Proc Means noprint mean var; var Y; by A B; output out=data2 mean=mean_Y var=var_Y; proc plot; plot mean_Y*A=B/ vpos=19 hpos=50; run; Proc SORT data=math581.data1; By TC; Proc Means noprint mean var; var Y; by TC; output out=data2 mean=mean_Y var=var_Y; proc plot; plot mean_Y*TC/ vpos=19 hpos=50; run;