Construct a design with balanced replication of factorial treatments. For a homogeneous set of subjects, randomly assign them to the cells of the factorial arrangement such that there is equal replication among the cells.
In this example, the effects of location and treatment are to be studied. Subjects are to be assigned to one of three locations and one of two treatments in a factorial arrangement. You want to assign subjects so that there are two subjects in each of the six location-treatment cells.
REQUIREMENTS:
Base SAS and SAS/STAT Software is required.
DETAILS:
PROC PLAN is used to output a data set of location and treatment combinations and a data set of randomized subject numbers. Merging these data sets one-to-one effectively randomizes the assignment of subjects to location-treatment combinations. The printed output produced by PROC PLAN shows the randomization of subject numbers.
Change the SEED= value, or remove the SEED= option, to get a different randomization.
The method shown here is an alternative to the method shown in the PROC PLAN documentation.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
title;
/* Change the SEED= value, or remove the SEED= option, to get a
* different randomization.
----------------------------------------------------------------------*/
proc plan seed=27371;
/* First, generate the basic runs and replicates of the design */
factors location=3 ordered treat=2 ordered rep=2 ordered;
output out=runs;
/* Then generate a randomized list of subject IDs */
factors id=12;
output out=ids;
run;
/* Merge the randomized subject IDs with the basic runs
----------------------------------------------------------------------*/
data design;
merge runs ids;
drop rep;
run;
/* Sort the design for display. Or skip this sort if you prefer.
----------------------------------------------------------------------*/
proc sort;
by id;
run;
proc print noobs;
title "The randomized design";
run;
/* Show that there are two replications of each treatment at each
* location.
----------------------------------------------------------------------*/
proc freq;
tables location*treat / nocol norow nopercent;
title "Note equal replication of treatments in locations";
run;
title;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
The PLAN Procedure
Factor
Select
Levels
Order
location
3
3
Ordered
treat
2
2
Ordered
rep
2
2
Ordered
location
treat
rep
1
1
1
2
2
1
2
2
1
1
2
2
1
2
3
1
1
2
2
1
2
The PLAN Procedure
Factor
Select
Levels
Order
id
12
12
Random
id
8
5
1
4
6
2
12
7
3
9
10
11
The randomized design
location
treat
id
1
2
1
2
1
2
3
1
3
1
2
4
1
1
5
2
1
6
2
2
7
1
1
8
3
1
9
3
2
10
3
2
11
2
2
12
Note equal replication of treatments in locations
The FREQ Procedure
Frequency
Table of location by treat
location
treat
Total
1
2
1
2
2
4
2
2
2
4
3
2
2
4
Total
6
6
12
For a homogeneous set of subjects, randomly assign them to the cells
of the factorial arrangement such that there is equal replication
among the cells.