## Computational Method

Let **X** represent the *n* ×*p* design matrix.
The columns of **X** contain only 0s and 1s.
Let **Y** represent the *n* ×1
vector of dependent variables.
In the GLM procedure, **X**'**X**,
**X**'**Y**, and **Y**'**Y**
are formed in main storage.
However, in the ANOVA procedure, only the diagonals of
**X**'**X** are computed, along with
**X**'**Y** and **Y**'**Y**.
Thus, PROC ANOVA saves a considerable
amount of storage as well as time.
The memory requirements for PROC ANOVA are asymptotically linear
functions of *n*^{2} and *nr*, where *n* is the number of
dependent variables and *r* the number of independent parameters.

The elements of **X**'**Y** are cell totals,
and the diagonal elements of **X**'**X** are
cell frequencies.
Since PROC ANOVA automatically pools omitted effects into the next
higher-level effect containing the names of the omitted effect
(or within-error), a slight modification to the rules given by
Searle (1971, p. 389) is used.

- PROC ANOVA computes the sum of squares for each effect
as if it is a main effect.
In other words, for each effect, PROC ANOVA squares each
cell total and divides by its cell frequency. The procedure then
adds these quantities together and subtracts the
correction factor for the mean (total squared over N).
- For each effect involving two class names,
PROC ANOVA subtracts the SS for any main effect with
a name that is contained in the two-factor effect.
- For each effect involving three class names, PROC ANOVA subtracts
the SS for all main effects and two-factor effects
with names that are contained in the three-factor effect.
If effects involving four or more class names
are present, the procedure continues this process.

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.