The FORECAST Procedure

Example 16.3 Forecasting Petroleum Sales

(View the complete code for this example.)

This example uses the double exponential smoothing method to forecast the monthly U.S. sales of petroleum and related products series (PETROL) from the data set SASHELP.USECON. These data are taken from Business Statistics, published by the U.S. Bureau of Economic Analysis.

The following statements plot the PETROL series:

title1 "Sales of Petroleum and Related Products";
proc sgplot data=sashelp.usecon;
   series x=date y=petrol / markers;
   xaxis values=('1jan80'd to '1jan92'd by year);
   yaxis values=(8000 to 20000 by 1000);
   format date year4.;
run;

The plot is shown in Output 16.3.1.

Output 16.3.1: Sales of Petroleum and Related Products

Sales of Petroleum and Related Products


The following statements produce the forecast:

proc forecast data=sashelp.usecon interval=month
              method=expo trend=2 lead=12
              out=out outfull outest=est;
   id date;
   var petrol;
   where date >= '1jan80'd;
run;

The following statements print the OUTEST= data set:

title2 'OUTEST= Data Set: EXPO Method';
proc print data=est;
run;

The PROC PRINT listing of the output data set is shown in Output 16.3.2.

Output 16.3.2: The OUTEST= Data Set Produced by PROC FORECAST

Sales of Petroleum and Related Products
OUTEST= Data Set: EXPO Method

Obs_TYPE_DATEPETROL
1NDEC91144
2NRESIDDEC91144
3DFDEC91142
4WEIGHTDEC910.1055728
5S1DEC9114165.259
6S2DEC9113933.435
7SIGMADEC911281.0945
8CONSTANTDEC9114397.084
9LINEARDEC9127.363164
10SSTDEC911.17001E9
11SSEDEC91233050838
12MSEDEC911641203.1
13RMSEDEC911281.0945
14MAPEDEC916.5514467
15MPEDEC91-0.147168
16MAEDEC91891.04243
17MEDEC918.2148584
18RSQUAREDEC910.8008122


The plot of the forecast is shown in Output 16.3.3.

title1 "Sales of Petroleum and Related Products";
title2 'Plot of Forecast: EXPO Method';
proc sgplot data=out;
   series x=date y=petrol / group=_type_;
   xaxis values=('1jan89'd to '1jan93'd by qtr);
   yaxis values=(10000 to 20000 by 1000);
   refline '15dec91'd / axis=x;
run;

Output 16.3.3: Forecast of Petroleum and Related Products

Forecast of Petroleum and Related Products