Test for Stationarity

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

                    SAS Sample Library

        Name: ariex08.sas
 Description: Example program from SAS/ETS User's Guide,
              The ARIMA Procedure
       Title: Test for Stationarity
     Product: SAS/ETS Software
        Keys: stationarity test
        PROC: ARIMA
       Notes:

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

ods graphics on;

   title1 'Simulated ARIMA(1,1,0)';
   data a;
     u1 = 0;
     u2=0;
     do i = -50 to 100;
        a = rannor( 1234 );
        du1 = u1 - u2;
        du = 0.6 * du1 + a;
        u = du + u1;
        if i > 0 then output;
        u2 = u1;
        u1 = u;
     end;
   run;

proc arima data=a;
  identify var=u;
run;

proc arima data=a;
  identify var=u stationarity=(adf=1);
  run;
  identify var=u stationarity=(pp=1);
  run;
quit;

proc arima data=a;
  identify var=u(1);
run;

proc arima data=a;
  identify var=u(1) stationarity=(adf=0);
  run;
  identify var=u(1) stationarity=(pp=0);
  run;
quit;

   title 'Simulated Trend Series with a Stationary AR(1) Process';
   data b;
     u1 = -20;
     do i = -50 to 100;
        a = rannor( 1234 );
        u = 2*i + 0.5*u1 + a;
        if i > 0 then output;
        u1 = u;
     end;
   run;

proc arima data=b;
  identify var=u;
run;

proc arima data=b;
  identify var=u stationarity=(adf=0);
  run;
  identify var=u stationarity=(pp=0);
  run;
quit;