BookmarkSubscribeRSS Feed
Forecaster
Obsidian | Level 7

Hello,

Updated with a real example:

I have a peculiar problem, I have ~1000 series that I have to forecast. The issue is each series has different start and end dates. I need to forecast 12 months from the end date. What is surprising to me is that when I run SAS forecast server, each series starts with the oldest date in all of the series and ends with a newest date of all the series.

As an example lest suppose if we have 3 series (a,b and c) with different start and end dates as shown below:

abc
Start DateJan-54Jan-50Jan-49
End DateDec-60Dec-58Dec-60

10-15-2014 6-44-35 PM.jpg

**********************************

When I input this to SAS forecast server and set the forecast horizon to 12 months. SAS forecast server does not forecast the individual series (I deselected forecast hierarchy).

As an example My Series b, produces 36 months of forecast !!! See below. The forecast should have started in Jan 59 and ended in Dec 59 but as shown below the forecast ends in Dec 1961 which is the forecast end date of series c. How do I enforce SAS to forecast only 12 months and only forecast for end period in that series only?

10-15-2014 6-52-14 PM.jpg

Below are my questions:

  1. How to force forecast server to look into only dates for individual series as opposed to all the dates in the series.
  2. How to force forecast server to forecast only from the last date of the individual series

I figured out the missing values can be deleted by setting the following options. I'm not sure if there is a better version to do this ? Also attached is the csv files for replication.

Thanks so much

10-15-2014 6-55-50 PM.jpg

2 REPLIES 2
udo_sas
SAS Employee

Hello -

SAS Forecast Studio works under the assumption that you want to create future forecasts and as such it assumes similar end dates for all of your series.

In order to accomplish this task the generated code of SAS Forecast Studio will use the "horizonstart" option to determine the maximum end date for all series. This is why your series b gets "extrapolated" first to match with the end date of a and c.

If you are comfortable with switching to SAS Forecast Server procedure code you can circumvent this behavior.

Thanks,

Udo

Simpified example:

data WORK.have    ;

infile 'yourpath\have.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;

informat DATE mmddyy10. ;

informat series $1. ;

informat value best32. ;

format DATE mmddyy10. ;

format series $1. ;

format value best12. ;

input

      DATE

      series $

      value

    ;

run;

proc hpfengine data=have outfor=work.want out=_null_ plot=forecasts;

id date interval=month;

forecast value;

by series;

run;

This will result in the following forecasts:

a.JPG

b.JPG

c.JPG

RyanK
Obsidian | Level 7

Forecaster,

We have the scenario of different end dates, and simply cater to the longest horizon then discard the unwanted periods.  The differing start dates is trickier to use Forecast Studio with.  It wants everything to have the same start date in the same project.  As Udo suggested, going straight to the forecast procedures is an option.  If you have a strong desire to utilize Forecast Studio, then the only method I can think of is to have fake time periods.

This would require some pre-processing of the data to make all the history end in the same period, call it period 0.  You would need to store a reference dataset outside of Forecast Studio that detailed what period 0 was for each time series.  As long as the leading values are missing (before history is available), then those periods should be safely ignored by the model.  You would still need to forecast to the longest horizon as I described above.

This approach could prove confusing, but workable as long as you are not reconciling to the hierarchy or have different time intervals.

Sounds like a good challenge.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1646 views
  • 0 likes
  • 3 in conversation