Update: corrected "_" problem of the code below.
Hello -
This example might be useful.
Thanks,
Udo
data mymonthlydata(keep=t air);
set sashelp.air;
t = intnx( 'month', '01jan2004'd, _n_-1 );
run;
proc hpfevents data=mymonthlydata;
var air;
id t interval=month start='01jan2004'd end='31dec2014'd;
eventkey AO11JAN2005D;
eventdata out=myevents;
eventdummy out=mydummydata;
run;
data mys1data(keep= t region store P1);
length region store $32;
set mydummydata;
region='R1';
store='S1';
P1 = air + 300*AO11JAN2005D ;
run;
data mys2data(keep= t region store P1);
length region store $32;
set mydummydata;
region='R1';
store='S2';
P1 = air + 300*AO11JAN2005D;
run;
data mys3data(keep= t region store P1);
length region store $32;
set mydummydata;
region='R2';
store='S1';
P1 = air;
run;
data mys4data(keep= t region store P1);
length region store $32;
set mydummydata;
region='R2';
store='S2';
P1 = air;
run;
data mysalesdata;
set mys1data mys2data mys3data mys4data;
run;
data eventsby;
length region store _NAME_ _EVENT_ _REQUIRED_ $32;
region='R1';
store='S1';
_NAME_= 'P1';
_EVENT_= 'AO11JAN2005D';
_REQUIRED_= 'YES';
output;
region='R2';
store='S1';
_NAME_= 'P1';
_EVENT_= 'AO11JAN2005D';
_REQUIRED_= 'YES';
output;
run;
ods select ARIMAEventSelect;
proc hpfdiagnose
data=mysalesdata
modelrepository=work.mymodels
outest=inest
inevent=myevents
eventby=eventsby
print=all;
id t interval=month;
forecast P1;
by region store;
arimax outlier=(detect=no);
run;
proc hpfengine
data=mysalesdata
plot=forecasts
modelrepository=work.mymodels
inest=inest
inevent=myevents
out=_null_ outfor=outfor1 outcomponent=outcomponent1;
id t interval=month;
forecast P1;
by region store;
run;
Message was edited by: Udo Sglavo
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.