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
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.