AUXDATA= Data Set

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

                    SAS Sample Library

        Name: x13ex11.sas
 Description: Example program from SAS/ETS User's Guide,
              The X13 Procedure
       Title: AUXDATA= Data Set
     Product: SAS/ETS Software
        Keys: seasonal adjustment of time series
        PROC: X13
       Notes:

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



data sales;
   set sashelp.air;
   sales = air;
   date = intnx( 'month', '01sep78'd, _n_-1 );
   format date monyy.;
run;

data auxreg(keep=date lengthofmonth);
   set sales;
   lengthofmonth = (INTNX('MONTH',date,1) - date) - (365/12);
   format date monyy.;
run;

title 'Align lengthofmonth Regressor from Auxreg to First Three Years';
ods select regParameterEstimates;
proc x13 data=sales(obs=36) date=date auxdata=auxreg;
   var sales;
   regression uservar=lengthofmonth;
   arima model=((0 1 1) (0 1 1));
   estimate;
run;

title 'Align lengthofmonth Regressor from Auxreg to Second Three Years';
ods select regParameterEstimates;
proc x13 data=sales(firstobs=37 obs=72) date=date auxdata=auxreg;
   var sales;
   regression uservar=lengthofmonth;
   arima model=((0 1 1) (0 1 1));
   estimate;
run;

data salesby;
     set sales(obs=72);
     if ( _n_ < 37 ) then by=1;
     else by=2;
run;
ods select regParameterEstimates;
title 'Align lengthofmonth Regressor from Auxreg to BY Groups';
proc x13 data=salesby date=date auxdata=auxreg;
   var sales;
   by by;
   regression uservar=lengthofmonth;
   arima model=((0 1 1) (0 1 1));
   estimate;
run;