If you use the MOVAVGn function (which is supported in certain SAS procedures including PROC MODEL, NLIN, PHREG, NLMIXED, CALIS, NLP, GENMOD, VARMAX, COMPILE, RISK, FCMP, PROTO, GA, and HPF) to obtain a moving average, be aware that the formula that is used in the MOVAVGn function prior to SAS® 9.2 is inconsistent with the definition of a moving average of order n that is most often found in the literature. The MOVAVGn function computes the moving average of order n+1; not the moving average of order n. Specifically, the formula that is used in the MOVAVGn function is:
MOVAVGn(x)=(x+lag_1(x)+...+lag_n(x))/(n+1);
where lag_n(x) is the n period lagged value of x.
The definition of moving average of order n that is most frequently found in the literature is:
Moving Average of order n=(x+lag_1(x)+...+lag_(n-1)(x))/n;
The definition of moving average of order n is changed from SAS 9.2 to agree with the definition that is most often given in the literature.