FOCUS AREAS

Examples Using The Forecast Command

The Forecast command invokes the Time Series Forecasting System. It is experimental in Release 6.12 and production in Release 7 of SAS/ETS software. Practical applications are illustrated in following examples.

  1. The following command brings up the Time Series Forecasting window with the data set name and series name filled in. The time ID variable is also filled in since the data set contains the variable date. The interval is filled in because the system recognizes that the observations are monthly.

       forecast data=sashelp.air var=air
    
  2. The following command brings up the Time Series Forecasting window with the project, data set name, series, time ID, and interval fields filled in, assuming that the project samproj was previously saved either interactively or using unattended mode, as shown in example 3. Previously fit models appear when the Develop Models or Manage Projects window is opened.

       forecast project=samproj
    
  3. The following command runs the system in unattended mode, fitting a model automatically, storing it in the project samproj in the default catalog sasuser.fmsproj, and placing the forecasts in the data set work.sampout.

       forecast data=sashelp.workers var=electric id=date interval=month
       project=samproj entry=forecast out=sampout
    
  4. The following command assumes that a new month's data have been added to the data set from the previous example and that an updated forecast is needed using the previously fit model. Time ranges are automatically updated to include the new data since the REEVAL keyword is included. Substitute REFIT for REEVAL if you want the system to reestimate the model parameters.

       forecast data=sashelp.workers var=electric id=date interval=month
       project=samproj entry=forecast out=sampout reeval
    
  5. The following command brings up the model viewer using the project created in the previous example and using 99 percent confidence limits in the forecast graph.

       forecast data=sashelp.workers var=electric id=date interval=month
       project=samproj entry=viewmod climit=99
    
  6. The final example illustrates using unattended mode with an existing project that has been defined interactively in order to set options that cannot be specified on the command line. In this example, the goal is to add a model to the model selection list and to specify that all models in that list be fit and that all models which are fit successfully be retained.

    • Bring up the Time Series Forecasting window and specify a new project name, workproj .

    • Select Develop Models, choosing sashelp.workers as the data set and masonry as the series.

    • Select Model Selection List from the Options pull-down menu.

    • In the Model Selection List window, click Actions, then Add, then ARIMA Model. Define the model ARIMA(0,1,0)(0,1,0)s NOINT by setting the differencing value to 1 under both ARIMA Options and Seasonal ARIMA Options. Select OK to save the model and OK to close the Model Selection List window.

    • Select Automatic Fit from the Options pull-down menu.

    • In the Automatic Model Selection Options window, select All autofit models in selection list in the Models to fit radio box, and select All models from the Models to keep combo box, then click OK to close the window.

    • Select Save Project from the File pull-down menu.

    • Close the Develop Models window and the Time Series Forecasting window.

    You now have a project with a new model added to the selection list, options set for automatic model fitting, and one series selected but no models fit. Next enter the command

       forecast data=sashelp.workers var=electric id=date interval=month
       project=workproj entry=forecast out=workforc
    
    The system runs in unattended mode to update the project and create the forecast data set workforc. Check the messages in the log window to find out if the run was successful and which model was fit.

    To see the forecast data set, issue the command viewtable workforc. To see the contents of the project, bring up the Time Series Forecasting window, open the project workproj, and select Manage Projects. You see that the variable electric is added to the project and that it has a forecasting model.

    Select this row in the table and then select List Models from the Tools pull-down menu. You see that all of the models in the selection list that fit successfully are there, including the new model you added to the selection list.