Resources

Analysis of Real Output Series

/*--------------------------------------------------------------

                    SAS Sample Library

        Name: autex01.sas
 Description: Example program from SAS/ETS User's Guide,
              The AUTOREG Procedure
       Title: Analysis of Real Output Series
     Product: SAS/ETS Software
        Keys: autoregression
        PROC: AUTOREG
       Notes:

--------------------------------------------------------------*/

title 'Analysis of Real GNP';
data gnp;
   date = intnx( 'year', '01jan1901'd, _n_-1 );
   format date year4.;
   input x @@;
   y  = log(x);
   dy = dif(y);
   t  = _n_;
   label y  = 'Real GNP'
         dy = 'First Difference of Y'
         t  = 'Time Trend';
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
;
   * ... datalines omitted ... *;


proc sgplot data=gnp noautolegend;
   scatter x=date y=y;
   xaxis grid values=('01jan1901'd '01jan1911'd '01jan1921'd '01jan1931'd
             '01jan1941'd '01jan1951'd '01jan1961'd '01jan1971'd
             '01jan1981'd '01jan1991'd);
run;

proc autoreg data=gnp;
   model y = t / nlag=2 method=ml;
run;

proc autoreg data = gnp;
   model y = / stationarity =(adf =3);
run;

proc autoreg data=gnp;
   model dy = / nlag=1 method=ml;
run;