|
Chapter Contents |
Previous |
Next |
| The PLAN Procedure |
You can use the PLAN procedure to design a completely randomized design. Suppose you have 12 experimental units, and want to assign one of two treatments to each unit. Use a DATA step to store the unrandomized design in a SAS data set, then call PROC PLAN to randomize it by specifying one RANDOM factor of 12 levels. The following statements produce Figure 50.3 and Figure 50.4:
title 'Completely Randomized Design';
/* The unrandomized design */
data a;
do unit=1 to 12;
if (unit <= 6) then treat=1;
else treat=2;
output;
end;
run;
/* Randomize the design */
proc plan seed=27371;
factors unit=12;
output data=a out=b;
run;
proc sort data=b;
by unit;
proc print;
run;
Figure 50.3 shows that the 12 levels of the unit factor have been randomly reordered and then lists the new ordering.
|
| ||||||||||||||||||||||||||||||||||
After the data is sorted by the unit variable, the randomized design is displayed in Figure 50.4.
|
|
You can also generate the plan by using a TREATMENTS statement instead of a DATA step. The following statements generate the same plan.
proc plan seed=27371;
factors unit=12;
treatments treat=12 cyclic (1 1 1 1 1 1 2 2 2 2 2 2);
output out=b;
run;
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.