The HPF Procedure

Example 2.2 Automatic Forecasting of Transactional Data

(View the complete code for this example.)

This example illustrates how the HPF procedure can be used to automatically forecast transactional data. Internet data is used for this illustration.

The data set WEBSITES contains data recorded at several Internet Web sites. WEBSITES contains a variable TIME and the variables BOATS, CARS, and PLANES that represent Internet Web site data. Each value of the TIME variable is recorded in ascending order, and the values of each of the other variables represent a transactional data series.

The following HPF procedure statements automatically forecast each of the transactional data series:

proc hpf data=websites out=nextweek lead=7;
   id time interval=dtday accumulate=total;
   forecast boats cars planes;
run;

The preceding statements accumulate the data into a daily time series, automatically generate forecasts for the BOATS, CARS, and PLANES variables in the input data set (WEBSITES) for the next week, and store the forecasts in the output data set (NEXTWEEK).

The following SGPLOT procedure statements plot the forecasts related to the Internet data:

title1 "Website Data";
proc sgplot data=nextweek noautolegend;
   series x=time y=boats / markers
      markerattrs=(symbol=circlefilled) lineattrs=(pattern=1);
   series x=time y=cars / markers
      markerattrs=(symbol=circlefilled) lineattrs=(pattern=1);
   series x=time y=planes / markers
      markerattrs=(symbol=circlefilled) lineattrs=(pattern=1);
   xaxis values=('13MAR2000:00:00:00'dt to '18APR2000:00:00:00'dt by dtweek);
   yaxis label='Websites';
   refline '11APR2000:00:00:00'dt / axis=x;
run;

The SGPLOT procedure results are shown in Output 2.2.1. The historical data is shown to the left of the vertical reference line, and the forecasts for the next twelve monthly periods are shown to the right.

Output 2.2.1: Internet Data Forecast Plots

Internet Data Forecast Plots


Last updated: July 31, 2025