The X12 Procedure |
This example demonstrates the use of the USERVAR= option in the REGRESSION statement to include user-defined regressors in the regARIMA model. The user-defined regressors must be defined as nonmissing values for the span of the series being modeled plus any forecast values. Suppose you have the data set SALESDATA with 132 monthly observations beginning in January of 1949.
title 'Data Set to be Seasonally Adjusted'; data salesdata; set sashelp.air(obs=132); run;
Since the regARIMA model forecasts one year ahead, the user-defined regressor must be defined for 144 observations that start in January of 1949. You can construct a simple length-of-month regressor by using the following DATA step.
title 'User-defined Regressor for Data to be Seasonally Adjusted'; data regressors(keep=date LengthOfMonth); set sashelp.air; LengthOfMonth = INTNX('MONTH',date,1) - date; run;
In this example, the two data sets are merged in order to use them as input to PROC X12. You can also use the AUXDATA= data set to input user-defined regressors. See Example 34.10 for more information. The BY statement is used to align the regressors with the time series by the time ID variable DATE.
title 'Data Set Containing Series and Regressors'; data datain; merge regressors salesdata; by date; run;
proc print data=datain(firstobs=121); run;
The last 24 observations of the input data set are displayed in Output 34.6.1. Note that the regressor variable is defined for one year (12 observations) beyond the span of the time series to be seasonally adjusted.
Data Set Containing Series and Regressors |
Obs | DATE | LengthOfMonth | AIR |
---|---|---|---|
121 | JAN59 | 31 | 360 |
122 | FEB59 | 28 | 342 |
123 | MAR59 | 31 | 406 |
124 | APR59 | 30 | 396 |
125 | MAY59 | 31 | 420 |
126 | JUN59 | 30 | 472 |
127 | JUL59 | 31 | 548 |
128 | AUG59 | 31 | 559 |
129 | SEP59 | 30 | 463 |
130 | OCT59 | 31 | 407 |
131 | NOV59 | 30 | 362 |
132 | DEC59 | 31 | 405 |
133 | JAN60 | 31 | . |
134 | FEB60 | 29 | . |
135 | MAR60 | 31 | . |
136 | APR60 | 30 | . |
137 | MAY60 | 31 | . |
138 | JUN60 | 30 | . |
139 | JUL60 | 31 | . |
140 | AUG60 | 31 | . |
141 | SEP60 | 30 | . |
142 | OCT60 | 31 | . |
143 | NOV60 | 30 | . |
144 | DEC60 | 31 | . |
The DATAIN data set is now ready to be used as input to PROC X12. Note that the DATE= variable and the user-defined regressors are automatically excluded from the variables to be seasonally adjusted.
title 'regARIMA Model with User-defined Regressor'; proc x12 data=datain date=DATE interval=MONTH; transform function=log; regression uservar=LengthOfMonth; automdl; x11; run;
The parameter estimates for the regARIMA model are shown in Output 34.6.2
Regression Model Parameter Estimates | ||||||
---|---|---|---|---|---|---|
For Variable AIR | ||||||
Type | Parameter | NoEst | Estimate | Standard Error | t Value | Pr > |t| |
User Defined | LengthOfMonth | Est | 0.04683 | 0.01834 | 2.55 | 0.0119 |
Copyright © SAS Institute, Inc. All Rights Reserved.