uniTimeSeries arima

Standard Case: Seasonal Sales Forecasting for Inventory Management

Scénario de test & Cas d'usage

Business Context

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 seasonal patterns (e.g., peaks during summer and holidays) and an upward trend.
About the Set : uniTimeSeries

Analysis and forecasting of univariate time series.

Discover all actions of uniTimeSeries
Data Preparation

Creation of a monthly time series dataset over 5 years. The data simulates product sales with a base level, a linear trend, and a multiplicative seasonality to mimic real-world retail cycles.

Copied!
1DATA mycas.monthly_sales;
2 FORMAT month monyy.;
3 DO i = 0 to 59;
4 month = intnx('month', '01jan2020'd, i);
5 seasonal_factor = 1 + sin(2 * 3.14159 * (month(month) / 12));
6 trend = 100 + (i * 1.5);
7 noise = rannor(12345) * 15;
8 sales = trend * seasonal_factor + noise;
9 OUTPUT;
10 END;
11RUN;

Étapes de réalisation

1
Load the monthly sales data into the CAS server. This step is implicitly handled by the data step creating the table in mycas.
Copied!
1/* Data already loaded in data_prep step */
2
Execute the arima action to identify, estimate, and forecast a seasonal ARIMA model. The model includes first-order regular differencing (diff=1), a seasonal AR component (p={factor=12}), and a seasonal MA component (q={factor=12}). A 12-month forecast is requested.
Copied!
1PROC CAS;
2 uniTimeSeries.arima /
3 TABLE={name='monthly_sales', caslib='mycas'},
4 timeId={name='month'},
5 interval='month',
6 seasonality=12,
7 series={name='sales', model={estimate={p={{factor=12}}, q={{factor=12}}, diff=1}, forecast={lead=12}}},
8 outFor={name='sales_forecast', caslib='mycas', replace=true},
9 outEst={name='sales_estimates', caslib='mycas', replace=true},
10 outStat={name='sales_fit_stats', caslib='mycas', replace=true};
11RUN;
12QUIT;

Expected Result


The action should successfully fit a seasonal ARIMA model. The 'sales_estimates' table should contain significant parameter estimates for the seasonal AR and MA terms. The 'sales_forecast' table must contain 12 future predicted values for 'sales', along with their confidence intervals. The 'sales_fit_stats' table will provide goodness-of-fit measures like AIC and MAPE, which can be used to assess model accuracy.