Details


Using PROC PLAN Interactively

After specifying a design with a FACTORS statement and running PROC PLAN with a RUN statement, you can generate additional plans and output data sets without reinvoking PROC PLAN.

In PROC PLAN, all statements can be used interactively. You can execute statements singly or in groups by following the single statement or group of statements with a RUN statement.

If you use PROC PLAN interactively, you can end the procedure with a DATA step, another PROC step, an ENDSAS statement, or a QUIT statement. The syntax of this statement is

  quit;  

When you use PROC PLAN interactively, additional RUN statements do not end the procedure but tell PROC PLAN to execute additional statements.

Output Data Sets

To understand how PROC PLAN creates output data sets, you need to look at how the procedure represents a plan. A plan is a list of values for all the factors, the values being chosen according to the factor-selection requests you specify. For example, consider the plan produced by the following statements:

  proc plan seed=12345;   factors a=3 b=2;   run;  

The plan as displayed by PROC PLAN is shown in Figure 55.5.

start figure
  The PLAN Procedure   Factor      Select      Levels     Order   a                3           3    Random   b                2           2    Random   a      -b-   2      2 1   1      1 2   3      2 1  
end figure

Figure 55.5: A Simple Plan

The first cell of the plan has a =2 and b =2, the second a =2 and b =1, the third a =1 and b =1, and so on. If you output the plan to a data set with the OUTPUT statement, by default the output data set contains a numeric variable with that factor s name ; the values of this numeric variable are the numbers of the successive levels selected for the factor in the plan. For example, the following statements produce Figure 55.6.

  proc plan seed=12345;   factors a=3 b=2;   output out=out;   proc print data=out;   run;  
start figure
  Obs    a    b   1     2    2   2     2    1   3     1    1   4     1    2   5     3    2   6     3    1  
end figure

Figure 55.6: Output Data Set from Simple Plan

Alternatively, you can specify the values that are output for a factor with the CVALS= or NVALS= option. Also, you can specify that the internal values be associated with the output values in a random order with the RANDOM option. See the OUTPUT Statement section on page 3343.

If you also specify an input data set (DATA=), each factor is associated with a variable in the DATA= data set. This occurs either implicitly by the factor and variable having the same name or explicitly as described in the specifications for the OUTPUT statement. In this case, the values of the variables corresponding to the factors are first read and then interpreted as describing the position of a cell in the plan. Then the respective values taken by the factors at that position are assigned to the variables in the OUT= data set. For example, consider the data set defined by the following statements.

  data in;   input a b;   datalines;   1 1   2 1   3 1   ;  

Suppose you specify this data set as an input data set for the OUTPUT statement.

  proc plan seed=12345;   factors a=3 b=2;   output out=out data=in;   proc print data=out;   run;  

PROC PLAN interprets the first observation as referring to the cell in the first row and column of the plan, since a =1 and b =1; likewise, the second observation is interpreted as the cell in the second row and first column, and the third observation as the cell in the third row and first column. In the output data set a and b have the values they have in the plan at these positions , as shown in Figure 55.7.

start figure
  Obs    a    b   1     2    2   2     1    1   3     3    2  
end figure

Figure 55.7: Output Form of Input Data Set from Simple Plan

When the factors are random, this has the effect of randomizing the input data set in the same manner as the plan produced (see the Randomizing Designs section on page 3351 and the Randomly Assigning Subjects to Treatments section on page 3337).

Specifying Factor Structures

By appropriately combining features of the PLAN procedure, you can construct an extensive set of designs. The basic tools are the factor-selections , which are used in the FACTORS and TREATMENTS statements. Table 55.1 summarizes how the procedure interprets various factor-selections ( assuming that the ORDERED option is not specified in the PROC PLAN statement).

Table 55.1: Factor Selection Interpretation

Form of

RequestInterpretation

Example

Results

name = m

produce a random permutation of the integers 1 , 2 , ..., m .

t=15

lists a random ordering of the numbers 1 , 2 , ..., 15.

name = m cyclic

cyclically permute the integers 1 , 2 , ..., m .

t=5 cyclic

selects the integers 1 to 5. On the next iteration, selects 2,3,4,5,1; then 3,4,5,1,2; and so on.

name = m of n

choose a random sample of m integers (without replacement) from the set of integers 1 , 2 , ..., n .

t=5 of 15

lists a random selection of 5 numbers from 1 to 15. First, the procedure selects 5 numbers and then arranges them in random order.

name = m of n ordered

has the same effect as name = m ordered.

t=5 of 15 ordered

lists the integers 1 to 5 in increasing order (same as t=5 ordered).

name = m of n cyclic

permute m of the n integers.

t=5 of 30 cyclic

selects the integers 1 to 5. On the next iteration, selects 2,3,4,5,6; then 3,4,5,6,7; and so on. The 30th iteration 30,1,2,3,4; the 31st iteration produces 1,2,3,4,5; andsoon.

name = m perm

produce a list of all permutations of m integers.

t=5 perm

lists the integers 1,2,3,4,5 on the first iteration; on the second lists 1,2,3,5,4; and on the 119th iteration lists 5,4,3,1,2; and on the last (120th) lists 5,4,3,2,1.

name = m of n comb

choose combinations of m integers from n integers.

t=3 of 5 comb

lists all combinations of 5 choose 3 integers. The first iteration is 1,2,3; the second is 1,2,4; the third is 1,2,5; and so on until the last iteration 3,4,5.

name = m of n cyclic ( initial-block )

permute m of the n integers, starting with the values specified in the initial-block .

t=4 of 30 cyclic (2 10 15 18)

selects the integers 2,10,15,18. On the next iteration, selects 3,11,16,19; then 4,12,17,20; and so on. The thirteenth iteration is 14,22,27,30; the fourteenth iteration is 15,23,28,1; and so on.

name = m of n cyclic ( initial-block ) increment

permute m of the n integers. Start with the values specified in the initial-block , then add the increment to each value.

t=4 of 30 cyclic (2 10 15 18) 2

selects the integers 2,10,15,18. On the next iteration, selects 4,12,17,20; then 6,14,19,22; and so on. The wrap occurs at the eighth iteration. The eighth iteration is 16,24,29,2; and so on.

In Table 55.1, in order for more than one iteration to appear in the plan, another name=j factor selection (with j > 1) must precede the example factor selection. For example, the following statements produce six of the iterations described in the last entry of Table 55.1.

  proc plan;   factors c=6 ordered t=4 of 30 cyclic (2 10 15 18) 2;   run;  

The following statements create a randomized complete block design and output the design to a data set.

  proc plan ordered;   factors blocks=3 cell=5;   treatments t=5 random;   output out=rcdb;   run;  

Table 55.2 lists other kinds of experiment designs that can be constructed by PROC PLAN, along with section and page references for them in this chapter.

Table 55.2: Experimental Design Examples

Design

Page Number

Completely randomized design

page 3337

Split-plot design

page 3352

Nested design

page 3353

Latin square design

page 3356

Generalized cyclic incomplete block design

page 3357

Randomizing Designs

In many situations, proper randomization is crucial for the validity of any conclusions to be drawn from an experiment. Randomization is used both to neutralize the effect of any unknown systematic biases that may be involved in the design as well as to provide a basis for the assumptions underlying the analysis.

You can use PROC PLAN to randomize an already-existing design: one produced by a previous call to PROC PLAN, perhaps, or a more specialized design taken from a standard reference such as Cochran and Cox (1957). The method is to specify the appropriate block structure in the FACTORS statement and then to specify the data set where the design is stored with the DATA= option in the OUTPUT statement. For an illustration of this method, see the Randomly Assigning Subjects to Treatments section on page 3337).

Two sorts of randomization are provided for, corresponding to the RANDOM factor selection and association types in the FACTORS and OUTPUT statements, respectively. Designs in which factors are completely nested (for example, block designs) should be randomized by specifying that the selection type of each factor is RANDOM in the FACTORS statement, which is the default (see Example 55.3 on page 3354). On the other hand, if the factors are crossed (for example, row-and-column designs), they should be randomized by one random reassignment of their values for the whole design. To do this, specify that the association type of each factor is RANDOM in the OUTPUT statement (see Example 55.4 on page 3356).

Displayed Output

The PLAN procedure displays

  • the m value for each factor, which is the number of values to be selected

  • the n value for each factor, which is the number of values to be selected from

  • the selection type for each factor, as specified in the FACTORS statement

  • the initial block and increment number for cyclic factors

  • the factor value selections making up each plan

In addition, notes are written to the log giving the starting and ending values of the random number seed for each call to PROC PLAN.

ODS Table Names

PROC PLAN assigns a name to each table it creates. You can use these names to reference the table when using the Output Delivery System (ODS) to select tables and create output data sets. These names are listed in the following table. For more information on ODS, see Chapter 14, Using the Output Delivery System.

Table 55.3: ODS Tables Produced by PROC PLAN

ODS Table Name

Description

Statement

FInfo

General factor information

FACTOR & no TREATMENT

PFInfo

Plot factor information

FACTOR & TREATMENT

Plan

Computed plan

default

TFInfo

Treatment factor information

FACTOR & TREATMENT




SAS.STAT 9.1 Users Guide (Vol. 5)
SAS.STAT 9.1 Users Guide (Vol. 5)
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 98

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net