The FORECAST Procedure

Example 16.2 Forecasting Retail Sales

(View the complete code for this example.)

This example uses the stepwise autoregressive method to forecast the monthly U.S. sales of durable goods (DURABLES) and nondurable goods (NONDUR) from the SASHELP.USECON data set. The data are from Business Statistics, published by the U.S. Bureau of Economic Analysis. The following statements plot the series:

title1 'Sales of Durable and Nondurable Goods';
title2 'Plot of Forecast from WINTERS Method';
proc sgplot data=sashelp.usecon;
   series x=date y=durables / markers markerattrs=(symbol=circlefilled);
   xaxis values=('1jan80'd to '1jan92'd by year);
   yaxis values=(60000 to 150000 by 10000);
   format date year4.;
run;
title1 'Sales of Durable and Nondurable Goods';
title2 'Plot of Forecast from WINTERS Method';
proc sgplot data=sashelp.usecon;
   series x=date y=nondur / markers markerattrs=(symbol=circlefilled);
   xaxis values=('1jan80'd to '1jan92'd by year);
   yaxis values=(70000 to 130000 by 10000);
   format date year4.;
run;

The plots are shown in Output 16.2.1 and Output 16.2.2.

Output 16.2.1: Durable Goods Sales

Durable Goods Sales


Output 16.2.2: Nondurable Goods Sales

Nondurable Goods Sales


The following statements produce the forecast:

title1 "Forecasting Sales of Durable and Nondurable Goods";

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

The following statements print the OUTEST= data set:

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

The PROC PRINT listing of the OUTEST= data set is shown in Output 16.2.3.

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

Forecasting Sales of Durable and Nondurable Goods
OUTEST= Data Set: STEPAR Method

Obs_TYPE_DATEDURABLESNONDUR
1NDEC91144144
2NRESIDDEC91144144
3DFDEC91137139
4SIGMADEC914519.4512452.2642
5CONSTANTDEC9171884.59773190.812
6LINEARDEC91400.90106308.5115
7AR01DEC910.58445150.8243265
8AR02DEC91..
9AR03DEC91..
10AR04DEC91..
11AR05DEC91..
12AR06DEC910.2097977.
13AR07DEC91..
14AR08DEC91..
15AR09DEC91..
16AR10DEC91-0.119425.
17AR11DEC91..
18AR12DEC910.61386990.8050854
19AR13DEC91-0.556707-0.741854
20SSTDEC914.923E102.8331E10
21SSEDEC911.88157E9544657337
22MSEDEC91137340933918398.1
23RMSEDEC913705.95381979.4944
24MAPEDEC912.92526011.6555935
25MPEDEC91-0.253607-0.085357
26MAEDEC912866.6751532.8453
27MEDEC91-67.87407-29.63026
28RSQUAREDEC910.96178030.9807752


The following statements plot the forecasts and confidence limits. The last two years of historical data are included in the plots to provide context for the forecast. A reference line is drawn at the start of the forecast period.

title1 'Plot of Forecasts from STEPAR Method';
proc sgplot data=out;
   series x=date y=durables / group=_type_;
   xaxis values=('1jan90'd to '1jan93'd by qtr);
   yaxis values=(100000 to 150000 by 10000);
   refline '15dec91'd / axis=x;
run;
proc sgplot data=out;
   series x=date y=nondur / group=_type_;
   xaxis values=('1jan90'd to '1jan93'd by qtr);
   yaxis values=(100000 to 140000 by 10000);
   refline '15dec91'd / axis=x;
run;

The plots are shown in Output 16.2.4 and Output 16.2.5.

Output 16.2.4: Forecast of Durable Goods Sales

Forecast of Durable Goods Sales


Output 16.2.5: Forecast of Nondurable Goods Sales

Forecast of Nondurable Goods Sales