The FORECAST Procedure

Getting Started: FORECAST Procedure

(View the complete code for this example.)

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

Obsdatesales
1JUL899.5161
2AUG899.6994
3SEP899.2644
4OCT899.6837
5NOV8910.0784
6DEC899.9005
7JAN9010.2375
8FEB9010.6940
9MAR9010.6290
10APR9011.0332
11MAY9011.0270
12JUN9011.4165
13JUL9011.2918
14AUG9011.3475
15SEP9011.2913
16OCT9011.3771
17NOV9011.5457
18DEC9011.6433
19JAN9111.9293
20FEB9111.9752
21MAR9111.9283
22APR9111.8985
23MAY9112.0419
24JUN9112.3537
25JUL9112.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

Obs_TYPE__LEAD_sales
1FORECAST112.6205
2FORECAST212.7665
3FORECAST312.9020
4FORECAST413.0322
5FORECAST513.1595
6FORECAST613.2854
7FORECAST713.4105
8FORECAST813.5351
9FORECAST913.6596
10FORECAST1013.7840