BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
FVidal
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
alexchien
Pyrite | Level 9

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 😆

Alex

View solution in original post

1 REPLY 1
alexchien
Pyrite | Level 9

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 😆

Alex

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

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.

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