Time Series Model Package

Using the TSM Package

The following steps provide a general outline of how to use each type of object in the TSM package. Subsequent sections describe each step in greater detail.

  1. Configure a model specification object.

  2. Use the TSM object with the model specification object to generate a forecast.

  3. Use TSM collector objects to extract results and parameter estimates from the TSM object.

  4. Use TSM repeater objects to replay collected parameters and specifications to another TSM object.

Step 1: Configure a Model Specification Object

Model specification objects define the time series model characteristics that you want to be applied to the TSM object, which then performs the model execution. Model specification objects use Open and Close methods to initialize and finalize model specifications. The basic execution pattern follows this sequence of operations:

  1. Declare: Create the model specification object by using the object declaration statement. The object declaration assigns a default model specification to the specification objects.

  2. Open: Initialize the specification object to a default state that is ready to accept configuration methods that shape the model and define its characteristics.

  3. Configure: Use object-specific model specification methods to configure the model. For example, in an ESMSPEC, you might specify the smoothing method or model to be used, specify a functional transformation for the dependent variable to force the use of specific smoothing parameters, or specify bounds on the estimated parameters. For an ARIMASPEC, you might specify a set of autoregressive or moving average backshift operator polynomial factors, specify differencing operators, add simple and complex transfer functions, or specify a functional transformation for the dependent variable.

  4. Close: Declare the model specification object to be complete and ready for use.

  5. Use: Use the completed model specification object with a TSM object to directly perform the specified time series model fit and forecast computations. You can also use model specification objects with the automatic time series modeling (ATSM) package to include custom models into its automatic time series forecasting process. For more information about this use, see Chapter 2, Automatic Time Series Modeling Package (SAS Visual Forecasting: Time Series Packages).

Step 2: Use a TSM Object with a Model Specification Object

The TSM object executes the time series model. The TSM object is configured with a time series model from one of the model specification objects. Then the TSM object applies that configuration to the time series data to produce a forecast. The basic execution pattern follows this sequence of operations:

  1. Declare: Create the TSM object by using the object declaration statement.

  2. Initialize: Add a model specification object to the TSM object.

  3. Specify variables: Specify the dependent series (Y) and any independent series (X) variables.

  4. Specify options: Specify other options and properties as appropriate.

  5. Run: Execute the model in the TSM object to produce its forecast.

  6. Extract: Extract the results by using collector objects.

Various properties (attributes) of the executed TSM object can be queried directly and saved into declared variables, or the results can be collected by the TSM collector objects for presentation and storage.

Step 3: Use the TSM Collector Objects

Collector objects enable you to create a snapshot of results from TSM objects and store those results in tables. Each collector object defines a table schema that is determined by the collector object’s design. The TSM collector objects follow a common pattern. The basic execution follows this sequence of operations:

  1. Declare: Create the collector object using the object declaration statement.

  2. Collect: Use the Collect method with a TSM object passed in as an argument to collects results from the TSM object. For example, the TSMPEST object collects parameter estimates from a TSM object, and the TSMSPEC object collects from a model specification’s XML. Rows that are collected are automatically appended to the collector’s associated table at the end of each BY group, and the collector object’s saved row set is automatically reset. Rows that are added to the table are qualified by the values of the corresponding values of the BY variable. This enables repeater objects to locate the rows that are relevant to each BY group and correctly replay that information into a TSM object. The nrows attribute returns the current row count in the collector. A missing value is returned if nothing has been collected. The data can now be used for reports or used by a repeater object on another model.

Step 4: Use the TSM Repeater Objects

Repeater objects read rows from a table and convert their contents back into useful information that can be used by other TSM objects. This is the inverse function of the collector objects. Each repeater object defines a table schema that is determined by its counterpart collector object’s design. Repeater objects must be associated with an existing table that has the table schema that is required by the repeater object. The basic execution follows this sequence of events:

  1. Declare: Create the repeater object by using the object declaration statement.

  2. Replay: Use the TSM.Replay method on a TSM object with the repeater object passed in as an argument to execute a new time series model. The replayed TSM object generates the forecast data that was produced by the new time series model. Then the data can be collected by using a collector object as described in Step 3.

Last updated: July 09, 2026