DYNAMICLINEAR Procedure

FILTER Statement

  • FILTER <options>;

The FILTER statement specifies the outputs and parameters of filtering. You can specify the following options:

BACK=number

specifies the number of steps from the end of the data set at which to begin generating output for the OUT=, OUTSIM=, and OUTFILTERINFO= options. The number should be less than or equal to the total number of observations minus one and must be greater than zero. When BACK=0, the output starts from the beginning of the data set. By default, BACK=1, which initiates the output one step before the end of the data set.

LEAD=number

specifies the quantity of multistep forecast values to be calculated during the filtering process. The number must be a nonnegative integer. By default, LEAD=1, which executes a one-step-ahead forecast.

OUT<(PERCENT=numeric-list)>=libref.data-table
OUT<(PCT=numeric-list)>=libref.data-table

writes the sample means of predictions, the sample variances, and the associated percentiles during the filtering process to a designated output data table. PERCENT=numeric-list is an optional component that denotes the desired percentile points. Every value in the numeric-list should be between 0 and 100, inclusive, with values separated by either commas or spaces. Notably, the values of 0 and 100 equate to the minimum and maximum values, respectively. By default, PERCENT=2.5 and 97.5, which represent the 2.5th and 97.5th percentile points, respectively. For more information, see the section OUT= Data Table Generated by the Statements. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

Consistency in the results of percentiles aligns with the PCTLDEF=4 criteria, as discussed in the section Calculating Percentiles (Base SAS Procedures Guide: Statistical Procedures) in the UNIVARIATE procedure.

OUTCOVARIANCE=libref.data-table
OUTCOV=libref.data-table

writes the covariances of samples of in-sample forecasting observations to an output table. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

Note: This table consumes memory resources, particularly in scenarios that involve multistep forecasting where the LEAD= option value is greater than 1 and the number of variables in the MODEL statement is large. The requirement for memory also increases when multiple steps at the end of the data are included for output, which occurs when the BACK= option value is 0 or greater than 1.

OUTFILTERINFO=(suboptions)

specifies the scope of filtering information to be exported to output tables. It includes the distribution parameters such as the prior, the naive posterior, and the posterior. Additionally, it encompasses the Kullback-Leibler divergence of posteriors, raw samples obtained during the prediction generation, and the recoupling of importance sampling. Note: Exercise caution when using the following suboptions, because they are memory-intensive.

You can specify the following suboptions:

KLDIVERGENCE=libref.data-table
KLDIV=libref.data-table

specifies the output table for Kullback-Leibler (KL) divergence information in the decoupling step of updating the distribution from naive posterior to posterior. The KL divergence is the indication of the closeness between the revised variational-Bayes-based posterior estimation and the true posterior. The larger the value, the closer the two distributions are. The range of the KL divergence is between 0 and 1, inclusive. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

NAIVEPOSTERIOR=(naiveposterior-options)
NAIVEPOST=(naiveposterior-options)

specifies which parameters of the naive posterior distribution to output.

You can specify the following naiveposterior-options:

COVARIANCE=libref.data-table
COV=libref.data-table

specifies the output table for the covariances of naive posterior normal-gamma distributions. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

GAMMA=libref.data-table

specifies the output table for the shape and rate parameters of naive posterior normal-gamma distributions. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

MEAN=libref.data-table

specifies the output table for the means of naive posterior normal-gamma distributions. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

POSTERIOR=(posterior-options)
POST=(posterior-options)

specifies which parameters of the posterior distribution to output.

You can specify the following posterior-options:

COVARIANCE=libref.data-table
COV=libref.data-table

specifies the output table for the covariances of posterior normal-gamma distributions. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

GAMMA=libref.data-table

specifies the output table for the shape and rate parameters of posterior normal-gamma distributions. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

MEAN=libref.data-table

specifies the output table for the means of posterior normal-gamma distributions. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

PREDICTIONSAMPLE=(predictionsample-options)
PREDSMPL=(predictionsample-options)

specifies which raw random samples to output during forecasting. Note: 1. These tables require significant memory resources, particularly the table that stores samples of state vectors (a table that you specify in the THETA= predictionsample-option). 2. The PREDSMPL= option is not supported when you run the procedure and enable GPUs.

You can specify the following predictionsample-options:

LAMBDA=libref.data-table

specifies the output table for raw random samples of precisions during forecasting. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

NU=libref.data-table

specifies the output table for raw random samples of observation errors during forecasting. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

THETA=libref.data-table

specifies the output table for raw random samples of state vectors during forecasting. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

PRIOR=(prior-options)

specifies which parameters of the prior distribution to output.

You can specify the following prior-options:

COVARIANCE=libref.data-table
COV=libref.data-table

specifies the output table for the covariances of prior normal-gamma distributions. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

GAMMA=libref.data-table

specifies the output table for the shape and rate parameters of prior normal-gamma distributions. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

MEAN=libref.data-table

specifies the output table for the means of prior normal-gamma distributions. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

RECOUPLINGSAMPLE=(recouplingsample-options)
RECSMPL=(recouplingsample-options)

specifies which raw random samples to output during the recoupling of importance sampling. Note: 1. These tables require significant memory resources, particularly the table that stores samples of state vectors (a table that you specify in the THETA= predictionsample-option). 2. The RECSMPL= option is not supported when you run the procedure and enable GPUs.

You can specify the following recouplingsample-options:

LAMBDA=libref.data-table

specifies the output table for raw random samples of precisions during the recoupling of importance sampling. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

THETA=libref.data-table

specifies the output table for raw random samples of state vectors during the recoupling of importance sampling. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

OUTSIM=libref.data-table

writes samples of in-sample forecasting observations to an output table. These samples are generated according to the prior distribution and are used to compute the statistics in the OUT= output data table. libref.data-table is a two-level name, where libref refers to the library, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.

Note: This table requires substantial memory resources, particularly in scenarios that involve multistep forecasting where the LEAD= option value is greater than 1. The requirement for memory also increases when multiple steps at the end of the data are included for output, which occurs when the BACK= option value is greater than 1 or when BACK=0.

Last updated: July 09, 2026