BookmarkSubscribeRSS Feed
Calcite | Level 5 EJ2
Calcite | Level 5

HI, i'm using Visual Forecasting.

While using atsm package in TSMODEL procedure, I wonder the difference 

diagnose.setOption('holdout', 6);




**i'm using Auto-forecasting node.



proc tsmodel data = &vf_libIn.."&vf_inData"n
          %if "&vf_inEventObj" ne "" %then %do;
             inobj = (&vf_inEventObj)
             outobj = (
                       outfor  = &vf_libOut.."&vf_outFor"n
                       outstat = &vf_libOut.."&vf_outStat"n
                       outmodelinfo = &vf_libOut.."&vf_outModelInfo"n
             outlog  = &vf_libOut.."&vf_outLog"n          
    *define time series ID variable and the time interval;
    id &vf_timeID interval = &vf_timeIDInterval;

    *define time series and the corresponding accumulation methods;

    *define the by variables if exist;
    %if "&vf_byVars" ne "" %then %do;
       by &vf_byVars;

    *using the ATSM (Automatic Time Series Model) package;
    require atsm;

    *starting user script;

        *declaring the ATSM objects;
        TSDF:     Time series data frame used to group series variables for DIAGNOSE and FORENG objects
        DIAGNOSE: Automatic time series model generation
        FORENG:   Automatic time series model selection and forecasting
        DIAGSPEC: Diagnostic control options for DIAGNOSE object
        OUTFOR:   Collector for FORENG forecasts
        OUTSTAT:  Collector for FORENG forecast performance statistics
        declare object diagnose(diagnose);
        declare object diagspec(diagspec);
        declare object dataframe(tsdf);
        declare object forecast(foreng);
        declare object outfor(outfor);
        declare object outstat(outstat);
        declare object outmodelinfo(outmodelinfo);

        *initialize the tsdf object and assign the time series roles;
        rc = dataframe.initialize();
        rc = dataframe.addY(&vf_depVar);
        *add independent variables to the tsdf object if there is any;
        %if "&vf_indepVars" ne "" %then %do;
        %if "&vf_inEventObj" ne "" or "&vf_events" ne "" %then %do;
            declare object ev1(event);
            rc = ev1.Initialize();
            %vf_addEvents(dataframe, ev1);

        *open the diagspec object and enable ESM and ARIMAX model class for diagnose;
        rc =;
        rc = diagspec.setESM();
        rc = diagspec.setARIMAX();
        rc = diagspec.setOption('criterion',"&_modelSelection_criteria");
        rc = diagspec.close();

        *set the diagnose object using the diagspec object and run the diagnose process;
        rc = diagnose.initialize(dataframe);
        rc = diagnose.setSpec(diagspec);
        rc = diagnose.setOption('holdout', 6);*/
        rc =;

        *initialize the foreng object with the diagnose result and run model selecting and generate forecasts;
        rc = forecast.initialize(diagnose);
        rc = forecast.setOption('criterion',"&_modelSelection_criteria");
        rc = forecast.setOption('lead',&vf_lead);
        rc = forecast.setOption('horizon',&vf_horizonStart);
        rc = forecast.setOption('holdout',6);*/
        rc = forecast.setOption('minobs.trend',2);
        rc = forecast.setOption('minobs.mean',2);
        %if "&vf_allowNegativeForecasts" eq "FALSE" %then %do;
            rc = forecast.setOption('',0);
        rc =;

        *collect the forecast and statistic-of-fit from the forgen object run results;
        rc = outfor.collect(forecast);
        rc = outstat.collect(forecast);
        rc = outmodelinfo.collect(forecast);

*generate outinformation CAS table;
data &vf_libOut.."&vf_outInformation"n;
    set work.sforecast_outInformation;

How to works these code on model?


What is the difference with the result of model A and model B?


model A : (add this code) /*holdout1*/ rc = diagnose.setOption('holdout',6);

model B : (add this code)/*holdout2*/ rc = forecast.setOption('holdout',6);<result><result>

Thank u 🙂 <result><result>



SAS Employee

All options for diagnose object determine how to choose best models from model families; all options for forecast objects determine how to choose the best model from model selection list.

For example, in this example code, ARIMA and ESM model families are enabled, so the diagnose.setOption('holdout')  helps choose one model from ARIMA family and one model from ESM family. If you don't set this option explicitly, it will use the default value 0 for holdout. After you already have a list of models, the forecast object forecast.setOption('holdout') helps select the best model among this list. If you don't set this option explicitly, it will use the default value 0 for holdout when making this decision.

So in your case, when you want to use non-zero holdout, you might want to specify this options in both objects to be consistent.



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. 

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
  • 2 in conversation