Example 1: Computing Durbin-Watson Statistic for a variable.
proc reg data = sp500; model open = /dw; run; quit; Dependent Variable: openAnalysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 0 0 . . . Error 247 1875052 7591.30215 Corrected Total 247 1875052Root MSE 87.12808 R-Square 0.0000 Dependent Mean 1194.88379 Adj R-Sq 0.0000 Coeff Var 7.29176Parameter EstimatesParameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 1194.88379 5.53264 215.97 <.0001 Durbin-Watson D 0.034 Number of Observations 248 1st Order Autocorrelation 0.979
The value of Durbin-Watson statistic is close to 2 if the errors are uncorrelated. In our example, it is .034. That means that there is a strong evidence that the variable open has high autocorrelation.
Example 2: Output 1st-order autocorrelation of multiple variables into a data set
Let's say that we want to compute the 1st-order autocorrelation for all the variables of interest. We can make use of the ODS facility to output the 1st-order autocorrelation for each variable to a data set called auto_corr.
A good resource of regression Diagnostics tutorial at: UCLA regression Diagnostics.proc reg data = sp500; model open high low close volume = /dw; ods output dwstatistic = auto_corr (where=(label1="1st Order Autocorrelation")) ; run; quit; proc print data = auto_corr noobs; var dependent label1 cvalue1; run; c Dependent Label1 Value1 open 1st Order Autocorrelation 0.979 high 1st Order Autocorrelation 0.984 low 1st Order Autocorrelation 0.983 close 1st Order Autocorrelation 0.981 volume 1st Order Autocorrelation 0.545