FOCUS AREAS

Time Series Forecasting System

The Forecast command invokes the Time Series Forecasting System (TSFS). It was introduced in Release 6.12 of SAS/ETS software, with changes and enhancements added in successive releases. The command syntax is

   FORECAST <PROJECT=project-name> <DATA=data-set> 
            <VAR=varname> <ID=timeid> <INTERVAL=interval> 
            <STAT=statistic> <CLIMIT=integer> 
            <HORIZON=integer> <ENTRY=name>
            <OUT=data-set> <KEEP=integer> <DIAG=yes/no>
            <AUDIT=yes/no> <REFIT> <REEVAL>

If the Forecast command is issued without arguments, the Time Series Forecasting window appears. Using the arguments, it is possible to

Examples of each of these capabilities are provided.



PROJECT= argument
specifies the name of the SAS catalog entry in which forecasting models and other results will be stored and from which previously stored results are loaded into the forecasting system. This can be a three level name of the form library.catalog.member, or a one level name where the library is assumed to be SASUSER and the catalog is assumed to be FMSPROJ. The fourth level (catalog entry type) need not be specified as it is always assumed to be FMSPROJ, a special entry type which stores foreasting projects.

DATA= argument
specifies the name of the input data source. A two level name of the form library.member, or a one level name if located in the WORK library. This can be a SAS table or any data source in the enterprise accessible to a SAS, provided it is arranged in time series form.

This means that

  • The observations are equally spaced in time
  • There is a time ID variable which identifies the date and/or time of each observation
  • The time ID has SAS date or datetime values and no missing values
  • The data are sorted in ascending order by the time ID
  • There is one and only one observation for each value of the time ID

For more information, see "Working with Time Series Data" in the Online Documentation or in the SAS/ETS User's Guide.

VAR= argument
specifies the series variable name. A numeric variable contained in the data set.

ID= argument
specifies the time ID variable name for the data set. If the ID= option is not specified, the system attempts to locate the variables named DATE, DATETIME, and TIME in the data set specified by the DATA= option. However, it is recommended that you specify the time ID variable whenever you are using the ENTRY= argument.

INTERVAL= argument
specifies the time interval between observations in the input data. Basic intervals are YEAR, SEMIYEAR, QTR, MONTH, SEMIMONTH, WEEK, WEEKDAY, DAY, HOUR, MINUTE, and SECOND. More complex intervals can be specified: See "Date Intervals, Formats, and Functions" in the Online Documentation or the SAS/ETS User's Guide. If the INTERVAL= option is not specified, the system attempts to determine the interval based on the time ID variable. However, it is recommended that you specify the interval whenever you are using the ENTRY= argument.

STAT= name
specifies the name of the goodness-of-fit statistic to be used as the model selection criterion. The default is RMSE. Valid names are
SSE: Sum of Square Error
MSE: Mean Square Error
RMSE: Root Mean Square Error
MAE: Mean Absolute Error
MAPE: Mean Absolute Percent Error
AIC: Akaike Information Criterion
SBC: Schwarz Bayesian Information Criterion
RSQUARE:    R-Square
ADJRSQ: Adjusted R-Square
RWRSQ: Random Walk R-Square
ARSQ: Amemiya's Adjusted R-Square
APC: Amemiya's Prediction Criterion

CLIMIT= integer
is an integer specifying the level of the confidence limits to be computed for the forecast. This integer represents a percentage, for example, 925 indicates 92.5% confidence limits. The default is 95, that is, 95% confidence limits.

HORIZON= integer
specifies the number of periods into the future for which forecasts are be computed. The default is 12 periods. The maximum is 9999.

ENTRY= name
specifies an entry point into the system. Valid names are
MAIN starts the system at the Time Series Forecasting window (default).
DEVMOD starts the system at the Develop Models window.
VIEWMOD     starts the system at the Model Viewer window. Specify a project containing a forecasting model using the PROJECT= option. If a project containing a model is not specified, the message "No forecasting model to view" appears.
VIEWSER starts the system at the Time Series Viewer window.
AUTOFIT runs the system in unattended mode, fitting a forecasting model automatically and saving it in a project. If the PROJECT=option is not specified, the default project name SASUSER.FMSPROJ.PROJ is used.
FORECAST         runs the system in unattended mode to generate a forecast data set. The name of this data set is specified by the OUT= parameter. If the OUT=parameter is not specified, a window appears to prompt for the name and label of the output data set. If the PROJECT=option is not specified, the default project name SASUSER.FMSPROJ.PROJ is used. If the project does not exist or does not contain a forecasting model, automatic model fitting is performed and the forecast is computed using the automatically selected model. If the project exists and contains a forecasting model, the forecast is computed using this model. If the series covers a different time range than it did when the project was created, use the REFIT or REEVAL keyword to reset the time ranges.


OUT= argument
gives the one or two-level name of a SAS data set in which forecasts are saved. Use in conjunction with ENTRY=FORECAST. If this option is omitted, the system prompts for the name of the forecast data set.

KEEP= integer
is available beginning with Version 8.0, and specifies the number of models to keep in the project for a specific series when multiple models are tried using the automatic model fitting process. The integer specified should be between 1 and 9, or 999 for all models. This is equivalent to the "models to keep" option in the Automatic Model Selection Options dialog box in the TSFS graphical user interface. Omitting KEEP= is equivalent to specifying KEEP=1; that is, only the best fitting model, according to the current model selection criterion, is kept.

DIAG= argument
is available beginning with Version 8.0, and specifies whether to subset the list of models to fit using series diagnostics during automatic model fitting. If DIAG=NO is specified, series diagnostics are not used, and the system attempts to fit all models in the model list. If DIAG=YES is specified or the option is omitted, only those models which fit the diagnostic criteria for the series in terms of log transformation, trend, and seasonality will be fit. This is equivalent to the "models to fit" option in the Automatic Model Selection Options dialog box in the TSFS graphical user interface.

AUDIT=argument
is available beginning with Version 8.2, and specifies whether to produce an audit trail in the SAS log. AUDIT=YES produces an audit trail, while AUDIT=NO or omitting this option does not produce an audit trail.

REFIT keyword
is used to refit a previously saved forecasting model using the current fit range, that is, to reestimate the model parameters. Refitting also causes the model to be reevaluated (statistics of fit recomputed) and causes the time ranges to be reset if the data range has changed, for example, if new observations have been added to the series. This keyword has no effect if you do not use the PROJECT= argument to reference an existing project containing a forecasting model. Use the REFIT keyword if you have added new data to the input series and you want to refit the forecasting model and update the forecast using the new time ranges. Be sure to use the same project, data set, and series names that you used previously.

REEVAL keyword
is used to reevaluate a previously saved forecasting model using the current evaluation range, that is, to recompute the statistics of fit. Reevaluating also causes the time ranges to be reset if the data range has changed, for example, if new observations have been added to the series. It does not refit the model parameters. This keyword has no effect if you also specify the REFIT keyword, or if you do not use the PROJECT= argument to reference an existing project containing a forecasting model. Use the REEVAL keyword if you have added new data to the input series and want to update your forecast using a previously fit forecasting model and the same project, data set, and series names that you used previously.