uniTimeSeries

arima

L'essentiel
At a glance
Data scientists and forecasting experts rely on the arima action to perform rigorous univariate time series modeling within the CAS engine. This versatile tool automates the identification and estimation of seasonal and non-seasonal patterns, transforming historical noise into structured predictive insights. By addressing stationarity and autocorrelation, it empowers organizations to anticipate market shifts and operational needs with high statistical confidence. To facilitate your technical implementation, we have curated a specialized FAQ section below that covers syntax nuances, parameter tuning, and performance optimization for large-scale temporal datasets.

Description

The `arima` action provides a comprehensive set of tools for univariate time series analysis, focusing on Autoregressive Integrated Moving Average (ARIMA) models. This action allows for the identification, estimation, and forecasting of time series data. It supports a wide range of model specifications, including simple and seasonal ARIMA models, as well as the inclusion of transfer functions for modeling the impact of explanatory variables. The action also provides options for handling missing values, specifying time intervals, and controlling the output tables for detailed analysis of results.

uniTimeSeries.arima <result=results> <status=rc> / alignId="BEGIN" | "END" | "MIDDLE", auxData={{castable-1} <, {castable-2}, ...>}, boundaryAlign="BOTH" | "END" | "NONE" | "START", casOut={casouttable}, display={displayTables}, interval="string", nlFormat=TRUE | FALSE, nThreads=integer, outEst={casouttable}, outFor={casouttable}, outputTables={outputTables}, outStat={casouttable}, seasonality=integer, series={{arimaSeriesStmt-1} <, {arimaSeriesStmt-2}, ...>}, sumOut={casouttable}, table={castable}, tEnd=double | date | datetime, timeId={casinvardesc}, trimId="BOTH" | "LEFT" | "NONE" | "RIGHT", tStart=double | date | datetime ;
Settings
ParameterDescription
alignId specifies the time ID alignment.
auxData specifies the auxiliary time series data tables.
boundaryAlign specifies the starting and ending timestamp alignment.
casOut names the output data table to contain the forecasts of the variables.
display specifies the list of display tables that you want the action to create. If this parameter is not specified, all tables are created.
interval specifies the time interval (or frequency).
nlFormat when set to True, chooses the best international format for the timestamp variable on the basis of the accumulation time interval. When set to False, it chooses the best English-language-based format for the timestamp variable. This option is ignored if you specify the format of the timestamp variable directly.
nThreads specifies the number of threads that are used per worker node in a CAS session. Threads are used to both preprocess and analyze input data in parallel. You must specify a value greater than or equal to 0. If you specify 0, which is the default, the number of threads is set to the maximum number of licensed cores.
outEst names the output data table to contain the model parameter estimates and the associated test statistics and probability values.
outFor names the output data table to contain the forecast time series components (actual, predicted, lower confidence limit, upper confidence limit, prediction error, prediction standard error).
outputTables specifies the list of display tables that you want to output as CAS tables. If this parameter is not specified, no tables are output as CAS tables.
outStat names the output data table to contain the fit statistics.
seasonality specifies the number of time periods per seasonal cycle (the default is based on the time interval).
series specifies the name of the series to be modeled and the modeling options.
sumOut names the output data table to contain the summary statistics and the forecast summation.
table specifies the input data table.
tEnd specifies the end of the time window.
timeId specifies the timestamp variable.
trimId specifies how to trim the time series. None means that no missing values are trimmed. LEFT trims missing values at the beginning of the time series. RIGHT trims missing values at the end of the time series. BOTH trims missing values at both the beginning and end of the time series.
tStart specifies the start of the time window.
Data Preparation View data prep sheet
Data Creation for ARIMA Analysis

This example creates a sample time series dataset named 'series' with a date and a value 'y'. This data will be used in subsequent examples to demonstrate the 'arima' action.

Copied!
1DATA mycas.series;
2 FORMAT date date9.;
3 DO date = '01jan2020'd to '31dec2024'd;
4 y = ranuni(1)*100;
5 OUTPUT;
6 END;
7RUN;

Examples

This example performs a simple ARIMA model estimation on the 'y' variable from the 'series' table. It specifies a simple autoregressive model of order 1 (p=1) and a simple differencing of order 1 (diff=1).

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 uniTimeSeries.arima /
3 TABLE={name='series', caslib='mycas'},
4 timeId={name='date'},
5 interval='day',
6 series={name='y', model={estimate={p=1, diff=1}}};
7RUN;
8QUIT;
Result :
The action will produce several output tables, including parameter estimates for the AR(1) model, fit statistics, and model information. The 'ParameterEstimates' table will show the estimated value for the AR1,1 parameter.

This example demonstrates a more complex seasonal ARIMA model. It includes a non-seasonal AR component (p=1), a seasonal AR component (p={factor={12}}), differencing (diff=1), and a seasonal moving average component (q={factor={12}}). It also applies a log transformation to the series. The action will estimate the model and then generate a 12-period forecast, storing the results in 'arima_forecast' and parameter estimates in 'arima_estimates'.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 uniTimeSeries.arima /
3 TABLE={name='series', caslib='mycas'},
4 timeId={name='date'},
5 interval='month',
6 seasonality=12,
7 series={name='y', model={estimate={transform='log', p={1, {factor=12}}, q={{factor=12}}, diff=1}, forecast={lead=12}}},
8 outFor={name='arima_forecast', caslib='mycas', replace=true},
9 outEst={name='arima_estimates', caslib='mycas', replace=true};
10RUN;
11QUIT;
Result :
The results will include tables for parameter estimates of the specified seasonal ARIMA model, fit statistics (such as AIC and SBC), and forecast results. The 'arima_forecast' table will contain the 12 forecasted values for 'y' along with their confidence intervals. The 'arima_estimates' table will contain the detailed parameter estimates for the model.

FAQ

What is the purpose of the arima action in the Univariate Time Series Analysis action set?
How do you specify the autoregressive part of an ARIMA model in this action?
What does the 'q' parameter control in the arima action?
Which estimation methods can be used for an ARIMA model?
How can I apply differencing to my time series using the arima action?
What kind of data transformations are available with the 'transform' parameter?
How do I generate forecasts with the arima action?

Associated Scenarios

Use Case
Standard Case: Seasonal Sales Forecasting for Inventory Management

A retail company needs to forecast monthly sales for a specific product line to optimize stock levels, reduce holding costs, and avoid stockouts. The historical data shows clear...

Use Case
Edge Case: Electricity Demand Forecast with Missing Data and Transformation

A utility provider needs to forecast hourly electricity demand. The data is collected from sensors which are prone to intermittent failures, leading to gaps in the time series. ...

Use Case
Performance Case: High-Volume Daily Financial Data Modeling

A quantitative analysis team at an investment firm needs to model a long series of daily stock closing prices. Due to the large volume of data (15+ years), the performance and s...