The FORECAST Procedure
Getting Started: FORECAST Procedure
(View the complete code for this example.)
- Giving Dates to Forecast Values
- Computing Confidence Limits
- Form of the OUT= Data Set
- Plotting Forecasts
- Plotting Residuals
- Model Parameters and Goodness-of-Fit Statistics
- Controlling the Forecasting Method
- Introduction to Forecasting Methods
- Time Trend Models
- Time Series Methods
- Combining Time Trend with Autoregressive Models
To use PROC FORECAST, specify the input and output data sets and the number of periods to forecast in the PROC FORECAST statement, and then list the variables to forecast in a VAR statement.
For example, suppose you have monthly data on the sales of some product in a data set named PAST, as shown in Figure 16.1, and you want to forecast sales for the next 10 months.
Figure 16.1: Example Data Set PAST
| Obs | date | sales |
|---|---|---|
| 1 | JUL89 | 9.5161 |
| 2 | AUG89 | 9.6994 |
| 3 | SEP89 | 9.2644 |
| 4 | OCT89 | 9.6837 |
| 5 | NOV89 | 10.0784 |
| 6 | DEC89 | 9.9005 |
| 7 | JAN90 | 10.2375 |
| 8 | FEB90 | 10.6940 |
| 9 | MAR90 | 10.6290 |
| 10 | APR90 | 11.0332 |
| 11 | MAY90 | 11.0270 |
| 12 | JUN90 | 11.4165 |
| 13 | JUL90 | 11.2918 |
| 14 | AUG90 | 11.3475 |
| 15 | SEP90 | 11.2913 |
| 16 | OCT90 | 11.3771 |
| 17 | NOV90 | 11.5457 |
| 18 | DEC90 | 11.6433 |
| 19 | JAN91 | 11.9293 |
| 20 | FEB91 | 11.9752 |
| 21 | MAR91 | 11.9283 |
| 22 | APR91 | 11.8985 |
| 23 | MAY91 | 12.0419 |
| 24 | JUN91 | 12.3537 |
| 25 | JUL91 | 12.4546 |
The following statements forecast 10 observations for the variable SALES by using the default STEPAR method and write the results to the output data set PRED:
proc forecast data=past lead=10 out=pred; var sales; run;
The following statements use the PRINT procedure to print the data set PRED:
proc print data=pred; run;
The PROC PRINT listing of the forecast data set PRED is shown in Figure 16.2.
Figure 16.2: Forecast Data Set PRED
Copyright © SAS Institute Inc. All rights reserved.