User-defined Regressors
/*--------------------------------------------------------------
SAS Sample Library
Name: x13ex06.sas
Description: Example program from SAS/ETS User's Guide,
The X13 Procedure
Title: User-defined Regressors
Product: SAS/ETS Software
Keys: seasonal adjustment of time series
PROC: X13
Notes:
--------------------------------------------------------------*/
title 'Data Set to be Seasonally Adjusted';
data salesdata;
set sashelp.air(obs=132);
run;
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;
title 'Data Set Containing Series and Regressors';
data datain;
merge regressors salesdata;
by date;
run;
proc print data=datain(firstobs=121);
run;
title 'regARIMA Model with User-defined Regressor';
proc x13 data=datain date=DATE interval=MONTH plots=none;
transform function=log;
regression uservar=LengthOfMonth / usertype=lom;
automdl;
x11;
output out=out a1 d11;
run;
title 'User-defined Regressor for Data to be Seasonally Adjusted, Mean Adjusted';
data datain(keep=date AIR LengthOfMonth);
set sashelp.air;
LengthOfMonth = INTNX('MONTH',date,1) - date - 30.4375;
run;
title 'regARIMA Model with Zero-Mean User-defined Regressor';
proc x13 data=datain date=DATE interval=MONTH span=(,DEC1959) plots=none;
transform function=log;
regression uservar=LengthOfMonth / usertype=lom;
automdl;
x11;
output out=outzm a1 d11;
run;
title 'regARIMA Model with Non-Zero-Mean User-Defined Regressor';
proc sgplot data=out;
series x=date y=air_A1 / name = "A1" markers
markerattrs=(color=red symbol='asterisk')
lineattrs=(color=red);
series x=date y=air_D11 / name= "D11" markers
markerattrs=(symbol='circle')
lineattrs=(color=blue);
yaxis label='Original and Seasonally Adjusted Time Series';
run;
title 'regARIMA Model with Zero-Mean User-Defined Regressor';
proc sgplot data=outzm;
series x=date y=air_A1 / name = "A1" markers
markerattrs=(color=red symbol='asterisk')
lineattrs=(color=red);
series x=date y=air_D11 / name= "D11" markers
markerattrs=(symbol='circle')
lineattrs=(color=blue);
yaxis label='Original and Seasonally Adjusted Time Series';
run;