SAS Sample Code
title 'Analysis of Real GNP';
data gnp;
date = intnx( 'year', '01jan1901'd, _n_-1 );
format date year4.;
input gnp @@;
lnGNP = log(gnp);
t = _n_;
datalines;
137.87 139.13 146.10 144.21 155.04 172.97 175.61 161.22
180.93 185.98 191.90 201.51 203.38 195.96 193.63 208.19
211.43 244.33 228.99 214.22 199.94 229.54 254.09 256.39
276.03 291.81 293.27 296.22 315.69 285.52 263.46 227.04
222.13 239.09 260.04 295.54 310.16 296.75 319.83 344.16
400.40 461.80 531.66 569.13 560.17 478.28 470.39 489.74
492.24 534.57 579.17 600.63 623.46 615.64 657.37 671.72
683.57 680.88 721.72 737.01 756.59 800.29 832.20 875.96
929.00 984.62 1011.38 1058.06 1087.58 1085.58 1122.42 1185.92
1254.20 1246.30 1231.61 1298.20 1369.71 1438.55 1479.44 1474.98
1512.15 1479.98 1534.68
;
ods html style=statistical;
ods graphics on;
proc autoreg data=gnp;
model lnGNP = t / nlag=2 method=ml;
run;
/* The same model but with individual plots */
proc autoreg data=gnp;
model lnGNP = t / nlag=2 method=ml plots(unpack);
run;
ods graphics off;
ods html close;
Statistics and Operations Research Home Page