Giving Dates to Forecast Values

Normally, your input data set has an ID variable that gives dates to the observations, and you want the forecast observations to have dates also. Usually, the ID variable has SAS date values. (See Chapter 3, Working with Time Series Data, for information about using SAS date and datetime values.) The ID statement specifies the identifying variable.

If the ID variable contains SAS date or datetime values, the INTERVAL= option should be used on the PROC FORECAST statement to specify the time interval between observations. (See Chapter 4, Date Intervals, Formats, and Functions, for more information about time intervals.) The FORECAST procedure uses the INTERVAL= option to generate correct dates for forecast observations.

The data set PAST, shown in Figure 16.1, has monthly observations and contains an ID variable DATE with SAS date values identifying each observation. The following statements produce the same forecast as the preceding example and also include the ID variable DATE in the output data set. Monthly SAS date values are extrapolated for the forecast observations.

proc forecast data=past interval=month lead=10 out=pred;
   var sales;
   id date;
run;