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

Forecast Studio: reasign all the models with touching datasets

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

Forecast Studio: reasign all the models with touching datasets

Hello,

I would like to know if there is the possibility in FS to select a model indirectly touching some dataset/s.

The thing is that I need to select certain model for a lot of items in the hierarchy and changing the models manually from FS could be really slow.

I'm using FS 12.1.

Thanks in advanced,

Ferran


Accepted Solutions
Solution
‎03-21-2017 04:15 AM
SAS Super FREQ
Posts: 79

Re: Forecast Studio: reasign all the models with touching datasets

Hi Ferran,

Yes it is possible to programatically set user selected models but it is not as easy as modifying some datasets. Also you need to understand the Forecast Studio project data structure and have access to the Forecast Server procedures. Ok here we go:

 

1. at the root of the project directory, you will find a SAS catalog called projectmodrep.sas7bcat. This is the model repository that the user selected models are stored. I will get back to this later.

 

2. for each level of the hierarchy (./<project name>/hierarchy/<level name>), you will see another model repo called autolevmodrep.sas7bcat. This catalog contains the model selecting list generated by PROC HPFDIAGNOSE. Also you will see a table called OUTSTATSELECT.sas7bdat. This table contains info about all the models for each series (_MODEL_), the corresponding selection list (_SELECT_), and the system selected model (_SELECTED_);

 

3. In the OUTSTATSELECT table, the value of the var _MODEL_ represents the name of the model specification stored in the autolevmodrep model repository. the value of the var _SELECT_ represents the name of the model selection list stored in the autolevmodrep model repository.

 

4. To set user selected model, you have to delete the corresponding model selection list from the autolevmodrep model repository and add a new model selection list with the same name to projectmodrep model repository.

 

For example, suppose there are 3 models generated by HPFDIAGNOSE for a series, you will find something like below in the OUTSTATSELECT table

 

_MODEL_     _SELECT_    _SELECTED_

HPF_10        HPF_13          YES

HPF_11        HPF_13          NO

HPF_12        HPF_13          NO

 

HPF_10 - HPF_12 corresponds to the model specifications and HPF_13 is the model selection list for HPF_10 to HPF_12. Suppose you want to change the selected model to HPF_11:

 

Use PROC  CATALOG to delete HPF_13 from autolevmodrep:

proc catalog cat=<levlib>.autolevmodrep;

    delete HPF_13;

run;

 

You then need to create a new model selection list with the same name in the projectmodrep using PROC HPFSELECT:

proc hpfselect repository=<projlib>.projectmodrep name=HPF_13;
    select choose = HPF_11;
    spec HPF_10 HPF_11 HPF_12;
run;

 

5. We are almost there.. Now we need to rerun model selection for the entire level to generate the correct output

First you need to concatenate the project and level specific model repositories:

catname <levlib>.levmodrep (<levlib>.autolevmodrep <projlib>.projectmodrep);

 

You then call PROC HPFENGINE with TASK = SELECTusing the concatenated catname <levlib>.levmodrep to get the right output.

 

It is complicated but it could be a nice project to write some cool sas code Smiley Embarassed

Alex

View solution in original post


All Replies
Solution
‎03-21-2017 04:15 AM
SAS Super FREQ
Posts: 79

Re: Forecast Studio: reasign all the models with touching datasets

Hi Ferran,

Yes it is possible to programatically set user selected models but it is not as easy as modifying some datasets. Also you need to understand the Forecast Studio project data structure and have access to the Forecast Server procedures. Ok here we go:

 

1. at the root of the project directory, you will find a SAS catalog called projectmodrep.sas7bcat. This is the model repository that the user selected models are stored. I will get back to this later.

 

2. for each level of the hierarchy (./<project name>/hierarchy/<level name>), you will see another model repo called autolevmodrep.sas7bcat. This catalog contains the model selecting list generated by PROC HPFDIAGNOSE. Also you will see a table called OUTSTATSELECT.sas7bdat. This table contains info about all the models for each series (_MODEL_), the corresponding selection list (_SELECT_), and the system selected model (_SELECTED_);

 

3. In the OUTSTATSELECT table, the value of the var _MODEL_ represents the name of the model specification stored in the autolevmodrep model repository. the value of the var _SELECT_ represents the name of the model selection list stored in the autolevmodrep model repository.

 

4. To set user selected model, you have to delete the corresponding model selection list from the autolevmodrep model repository and add a new model selection list with the same name to projectmodrep model repository.

 

For example, suppose there are 3 models generated by HPFDIAGNOSE for a series, you will find something like below in the OUTSTATSELECT table

 

_MODEL_     _SELECT_    _SELECTED_

HPF_10        HPF_13          YES

HPF_11        HPF_13          NO

HPF_12        HPF_13          NO

 

HPF_10 - HPF_12 corresponds to the model specifications and HPF_13 is the model selection list for HPF_10 to HPF_12. Suppose you want to change the selected model to HPF_11:

 

Use PROC  CATALOG to delete HPF_13 from autolevmodrep:

proc catalog cat=<levlib>.autolevmodrep;

    delete HPF_13;

run;

 

You then need to create a new model selection list with the same name in the projectmodrep using PROC HPFSELECT:

proc hpfselect repository=<projlib>.projectmodrep name=HPF_13;
    select choose = HPF_11;
    spec HPF_10 HPF_11 HPF_12;
run;

 

5. We are almost there.. Now we need to rerun model selection for the entire level to generate the correct output

First you need to concatenate the project and level specific model repositories:

catname <levlib>.levmodrep (<levlib>.autolevmodrep <projlib>.projectmodrep);

 

You then call PROC HPFENGINE with TASK = SELECTusing the concatenated catname <levlib>.levmodrep to get the right output.

 

It is complicated but it could be a nice project to write some cool sas code Smiley Embarassed

Alex

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 171 views
  • 2 likes
  • 2 in conversation