data crdsamp;
input Trt $ Rep Sample Yield;
datalines;
A 1 1 78
A 1 2 82
A 2 1 74
A 2 2 78
A 3 1 80
A 3 2 84
B 1 1 68
B 1 2 64
B 2 1 62
B 2 2 66
B 3 1 70
B 3 2 60
C 1 1 89
C 1 2 87
C 2 1 88
C 2 2 92
C 3 1 90
C 3 2 96
;;
proc print;
title 'Printout of CRD Data with Sampling';
run;
proc anova;
classes rep sample trt;
model yield=trt rep*trt;
*comment: The rep*label statement gives you the experimental error SOV;
*Comment: The sampling error will be located under the Model SOV on the top of the SAS
output. By default, this error term is used by SAS to calculate the F-values.;
test h=trt e=rep*trt;
*Comment: The test h statement tells SAS how to run the F-test you want. The h refers
to the numerator of the F-test (i.e. trt)and e refers to the denominator of
the F-test;
means trt/lsd e=rep*trt;
*Comment: For the LSD test, you need to specifiy what MS to use to calculate the standard
error of the difference. By default, SAS uses the Error MS from the top of the SAS output;
title 'ANOVA for CRD with Sampling';
run;