DESIGN Function

DESIGN (column-vector) ;

The DESIGN function creates a design matrix of zeros and ones from the column vector specified by column-vector. Each unique value of the column vector generates a column of the design matrix. The columns are arranged in the sort order of the original values. If $x_ i$ is the $i$th sorted value in the column vector, x, then the $i$th column of the design matrix contains ones in rows for which x has the value $x_ i$, and contains zeros elsewhere.

For example, the following statements produce a design matrix for a column vector that contains three unique values. The first column corresponds to the 'A' level, the second column corresponds to the 'B' level, and the third column corresponds to the 'C' level.

x = {C, A, B, B, A, A};
m = design(x);

cols = unique(x);
print m[colname=cols];

Figure 24.99: Design Matrix for a Vector with Three Unique Values

m
A B C
0 0 1
1 0 0
0 1 0
0 1 0
1 0 0
1 0 0


The design matrix that is returned by the DESIGN function corresponds to the GLM parameterization of classification variables as documented in the section Parameterization of Model Effects in the SAS/STAT User's Guide. See also the documentation for the DESIGNF function.