# The PLAN Procedure

## Example 67.2 A Hierarchical Design

In this example, three plants are nested within four pots, which are nested within three houses. The FACTORS statement requests a random permutation of the numbers 1, 2, and 3 to choose Houses randomly. The second step requests a random permutation of the numbers 1, 2, 3, and 4 for each of those first three numbers to randomly assign Pots to Houses. Finally, the FACTORS statement requests a random permutation of 1, 2, and 3 for each of the 12 integers in the second set of permutations. This last step randomly assigns Plants to Pots. The following statements produce Output 67.2.1:

```title 'Hierarchical Design';
proc plan seed=17431;
factors Houses=3 Pots=4 Plants=3 / noprint;
output out=nested;
run;

proc print data=nested;
run;
```

Output 67.2.1 A Hierarchical Design
 Hierarchical Design

Obs Houses Pots Plants
1 1 3 2
2 1 3 3
3 1 3 1
4 1 1 3
5 1 1 1
6 1 1 2
7 1 2 2
8 1 2 3
9 1 2 1
10 1 4 3
11 1 4 2
12 1 4 1
13 2 4 1
14 2 4 3
15 2 4 2
16 2 2 2
17 2 2 1
18 2 2 3
19 2 3 2
20 2 3 3
21 2 3 1
22 2 1 2
23 2 1 3
24 2 1 1
25 3 4 1
26 3 4 3
27 3 4 2
28 3 1 3
29 3 1 2
30 3 1 1
31 3 2 1
32 3 2 2
33 3 2 3
34 3 3 3
35 3 3 2
36 3 3 1