uniTimeSeries

esm

Description

The `uniTimeSeries.esm` action provides exponential smoothing models for univariate time series analysis. It is designed to automatically process transactional data, accumulating it into time series based on a specified time interval (e.g., daily, monthly). The action can automatically select the best smoothing model (Simple, Double, Linear, Damped Trend, Seasonal, Winters, etc.) based on a specified selection criterion (like RMSE or AIC) or apply a specific user-defined method. It generates forecasts, confidence intervals, and various fit statistics.

Settings
ParameterDescription
tableSpecifies the input data table containing the time series data. This is a required parameter.
timeIdSpecifies the timestamp variable in the input table. This variable defines the time index for the analysis.
intervalSpecifies the frequency of the accumulated time series (e.g., 'DAY', 'MONTH', 'YEAR').
forecastSpecifies options related to the forecast, such as the target variable name, the forecasting method (e.g., BEST, WINTERS), the lead (number of periods to forecast), and the significance level (alpha).
casOutNames the output table that will contain the forecasts of the variables.
outForNames the output table that will contain detailed forecast components including actual, predicted, confidence limits, and prediction errors.
outStatNames the output table that will contain the fit statistics (e.g., RMSE, AIC) for the selected models.
outEstNames the output table to contain the model parameter estimates.
seasonalitySpecifies the length of the seasonal cycle. If not specified, it is inferred from the time interval.
Data Preparation View data prep sheet
Create Sample Time Series Data

Generates a synthetic dataset containing monthly sales data with a trend and seasonality, then loads it into a CAS library.

Copied!
1 
2DATA casuser.sales_data;
3date = '01JAN2020'd;
4DO i = 1 to 48;
5sales = 100 + i + 10 * sin(i) + 5 * rannor(123);
6OUTPUT;
7date = intnx('month', date, 1);
8END;
9FORMAT date date9.;
10keep date sales;
11 
12RUN;
13 

Examples

Performs automatic forecasting on the 'sales' variable using the 'BEST' exponential smoothing method selection, accumulated by month.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3uniTimeSeries.esm / TABLE={name="sales_data", caslib="casuser"} timeId={name="date"} interval="month" forecast={{name="sales", method="BEST", lead=12}};
4 
5RUN;
6 
Result :
The action generates forecasts for the next 12 months using the model that best fits the data (e.g., Winters method if seasonality is detected) and prints the results.

Forecasts the 'sales' variable using the Winters multiplicative method (suitable for trend and seasonality), requests 12 periods ahead, and saves detailed forecast data, statistics, and estimates to specific CAS tables.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3uniTimeSeries.esm / TABLE={name="sales_data", caslib="casuser"} timeId={name="date"} interval="month" forecast={{name="sales", method="WINTERS", lead=12, alpha=0.05}} outFor={name="sales_forecast", caslib="casuser", replace=true} outStat={name="sales_stats", caslib="casuser", replace=true} outEst={name="sales_estimates", caslib="casuser", replace=true};
4 
5RUN;
6 
Result :
The action forces the use of the Winters method. It produces three output tables: 'sales_forecast' containing the time series values and confidence intervals, 'sales_stats' containing fit metrics like RMSE, and 'sales_estimates' containing the smoothing weights.

FAQ

What is the purpose of the esm action?
Which parameter is required to define the frequency of the time series?
What are the available forecasting methods in the esm action?
Which output table contains the model parameter estimates?
How can I control parallel processing in the esm action?
What does the 'outFor' output table contain?