Each term in a model is called an effect. Effects are specified in the MODEL statement. You specify effects with a special notation that uses variable names and operators. There are two types of variables, classification (or 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. Crossing is the type of operator most commonly used in generalized linear models.
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 types of effects most useful in generalized linear models are shown in the following list. Assume that A
, B
, and C
are classification variables and that 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 joining two or more classification variables with asterisks: 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
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 consists of two effects joined with a vertical bar (|). It 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 in the bar operator can be classification variables, continuous variables, or combinations of effects defined
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
.