Published on :
Statistical EXTERNAL

CUSUM Macro - Recursive Residuals Analysis

This code is also available in: Deutsch Español Français
Awaiting validation
This macro implements the method of Brown, Durbin, and Evans (1975). It uses the IML matrix language to perform recursive regressions, updating the inverse matrix and coefficients step-by-step to generate stability statistics (CUSUM, CUSUMSS). The results are stored in a SAS© table with appropriate labels.
Data Analysis

Type : EXTERNAL


The macro expects a SAS table as input (parameter &data, default _last_) containing the target variable (&yvar) and the regressors (&xvars).

1 Code Block
PROC IML Data
Explanation :
The core of the processing: PROC IML loads data into matrices, performs inverse and recursive updates of regression parameters to calculate residuals, then exports the results. A final Data Step applies the labels.
Copied!
1%macro cusum(
2 DATA=_last_, /* name of input data set */
3 yvar=, /* response variable */
4 xvars=, /* predictor variables */
5 out=cusum /* name of output data set */
6 );
7 
8PROC IML;
9 use &DATA;
10 read all var {&xvars} into x[ colname=xname ];
11 read all var {&yvar} into y[ colname=yname ];
12 close &DATA;
13 /* ... Calculs matriciels et récursivité ... */
14 create &out from x [ colname=rnames ];
15 append from x;
16QUIT;
17 
18DATA &out;
19 SET &out;
20 label
21 residual='Recursive residual'
22 cusum='CUSUM value'
23 cusumss ='Cumulative SS';
24%mend;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : JPS--25OCT79; Brown, Durbin, and Evans (1975)