Scénario de test & Cas d'usage
Analysis and forecasting of univariate time series.
Discover all actions of uniTimeSeriesCreation 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.
| 1 | DATA 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; |
| 11 | RUN; |
| 1 | /* Data already loaded in data_prep step */ |
| 1 | PROC 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}; |
| 11 | RUN; |
| 12 | QUIT; |
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.