Resources

Getting Started Example for PROC ARIMA

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

                    SAS Sample Library

        Name: arigs.sas
 Description: Example program from SAS/ETS User's Guide,
              The ARIMA Procedure
       Title: Getting Started Example for PROC ARIMA
     Product: SAS/ETS Software
        Keys: time series analysis
        PROC: ARIMA
       Notes:

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

ods graphics on;

data test;
   sales = 100;
   nl = 0; al = 0;
   do i = 1 to 100;
      a = rannor(12345);
      n = .75 * nl + .5 * al + a;
      al = a;
      nl = n;
      z = n + 1;
      sales = sales + z;
      date = intnx( 'month', '1jan1988'd, i-1 );
      format date monyy.;
      output;
   end;
run;

proc sgplot data=test;
   scatter y=sales x=date;
run;

proc arima data=test ;
   identify var=sales nlag=24;
run;

proc arima data=test;
   identify var=sales(1);
run;

   estimate p=1;
   run;

   estimate p=1 q=1;
   run;

   outlier;
   run;

   forecast lead=12 interval=month id=date out=results;
   run;

data a;
   mu = 200;
   w0 = -10;
   do i = 1 to 100;
     ap = 4*rannor(12345);
     a  = 8*rannor(12345);
     price = 50 + i + ap;
     sales = mu + w0*price + a;
     date = intnx( 'month', '1jan1988'd, i-1 );
     format date monyy.;
     output;
     end;
run;


proc arima data=a;
   identify var=sales crosscorr=price;
   estimate input=price;
run;