Each term in a model is called an effect. You specify effects in the MODEL statement by using a special notation that uses variable names and operators. There are two types of variables: classification ( CLASS) variables and continuous variables. There are two primary types of operators: crossing and nesting. A third type, the bar operator, is used to simplify effect specification.
Variables that identify classification levels are called CLASS variables in SAS and are identified in a CLASS statement. These might also be called categorical, qualitative, discrete, or nominal variables. CLASS variables can be either character or numeric. The values of CLASS variables are called levels. For example, the CLASS variable Sex
could have the levels "male" and "female."
In a model, an explanatory variable that is not declared in a CLASS statement is assumed to be continuous. Continuous variables must be numeric. For example, the heights and weights of subjects in an experiment are continuous variables.
The following list shows types of effects that are often useful in practice, where A
, B
, and C
are classification variables and X1
and X2
are continuous variables:
Regressor effects are specified by writing continuous variables by themselves: X1
, X2
.
Polynomial effects are specified by joining two or more continuous variables with asterisks: X1
*X2
.
Main effects are specified by writing classification variables by themselves: A
, B
, C
.
Crossed effects (interactions) are specified by using asterisks to join two or more classification variables: A
*B
, B
*C
, A
*B
*C
.
Nested effects are specified by following a main effect or crossed effect with a classification variable or list of classification variables
that are enclosed in parentheses: B
(A
), C
(B
A
), A
*B
(C
). In the preceding example, B
(A
) is "B
nested within A
."
Combinations of continuous and classification variables can be specified in the same way by using the crossing and nesting operators.
The bar operator uses a vertical bar (|) to join two effects. The bar operator is shorthand notation for including the left-hand side, the
right-hand side, and the cross between them as effects in the model. For example, A
| B
is equivalent to A
B
A
*B
. The effects that are joined by the bar operator can be classification variables, continuous variables, or combinations of
effects that are defined by using operators. Multiple bars are permitted. For example, A
| B
| C
means A B C A*B A*C B*C A*B*C
.
You can specify the maximum number of variables in any effect that results from bar evaluation by specifying the maximum number,
preceded by an @ sign. For example, A
| B
| C
@2 results in effects that involve two or fewer variables: A B C A*B A*C B*C
.