Forecasting using SAS Forecast Server, SAS/ETS, and more

Using eventby in a group of events

Reply
Occasional Contributor
Posts: 15

Using eventby in a group of events

Hello folks, anyone know hot to use the eventby in hpfdignose? I'm in doubt about the layout of data. Thanks.
SAS Employee
Posts: 416

Re: Using eventby in a group of events

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

Occasional Contributor
Posts: 15

Re: Using eventby in a group of events

It works!!!
Udo, thanks again!!!
Ask a Question
Discussion stats
  • 2 replies
  • 466 views
  • 0 likes
  • 2 in conversation