All of the preceding examples involve designs with completely nested block structures, for which PROC PLAN was especially designed. However, by appropriate coordination of its facilities, PROC PLAN can accommodate a much wider class of designs. A Latin square design is based on experimental units that have a row-and-column block structure. The following statements use the CYCLIC option in the TREATMENTS statement to generate a simple Latin square. The RANDOM option in the OUTPUT statement randomizes the generated Latin square by randomly permuting the row, column, and treatment values independently. This example also uses factor-value-settings in the OUTPUT statement.
title 'Latin Square Design'; proc plan seed=37430; factors Row=4 ordered Col=4 ordered / noprint; treatments Tmt=4 cyclic; output out=LatinSquare Row cvals=('Day 1' 'Day 2' 'Day 3' 'Day 4') random Col cvals=('Lab 1' 'Lab 2' 'Lab 3' 'Lab 4') random Tmt nvals=( 0 100 250 450) random; quit;
proc sort data=LatinSquare out=LatinSquare; by Row Col; run; proc transpose data= LatinSquare(rename=(Col=_NAME_)) out =tLatinSquare(drop=_NAME_); by Row; var Tmt; run; proc print data=tLatinSquare noobs; run;
The preceding statements produce Output 68.4.1.
Output 68.4.1: A Randomized Latin Square Design
Latin Square Design |
Row | Lab_1 | Lab_2 | Lab_3 | Lab_4 |
---|---|---|---|---|
Day 1 | 0 | 250 | 100 | 450 |
Day 2 | 250 | 450 | 0 | 100 |
Day 3 | 100 | 0 | 450 | 250 |
Day 4 | 450 | 100 | 250 | 0 |
You can use the PLAN procedure to randomize Latin squares from any transformation sets. See Kempthorne (1952) for definitions of transformation sets. In particular, the following DATA step and PROC PLAN statements demonstrate how to randomize a Latin square from the second transformation set defined in Kempthorne (1952). The following DATA step creates a Latin square from the transformation set 2:
data Unrandomized; do Row = 1 to 4; do Col = 1 to 4; input Tmt @@; output; end; end; datalines; 1 2 3 4 2 1 4 3 3 4 1 2 4 3 2 1 ;
The following PROC PLAN statements permute the rows and columns and randomly assign treatment levels.
proc plan; factors Row = 4; output data= Unrandomized out=Randomized1; run; factors Col = 4; output data= Randomized1 out=Randomized2; run; factors Tmt = 4; output data= Randomized2 out=Randomized3; run; proc sort data=Randomized3; by Row Col; run; proc transpose data= Randomized3 out =tLatinSquare2(drop=_NAME_); by Row; var Tmt; run; proc print data=tLatinSquare2 noobs; run;