BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Calcite | Level 5

I have daily sales data by sku for multiple stores.  Successfully imported data and did forecast with Time ID=DAY.  But my MAPES were way too high because daily is just too granular.  


Now I want to use weekly sales and forecase 1 week out.  My data starts in Jan 29, 2017 to Jan 24 2018.


I have a Year column (2017 or 2018) and a week number column (1-52).  


I tried to use week number as my time ID but alas it was unrecognized and am assuming my two columns need to be combined.


So should the format be something like 201715  which would represent the 15th week in 2017.  Will Forecast Studio recognize this?


Thank you






Accepted Solutions
Obsidian | Level 7

You can use the same TIME ID (DAY), just change the interval to week. Forecast Studio shall automatically aggregate the data to weekly data for you.

View solution in original post

Super User

Caveat: I don't have much experience with the forecasting procedures so take this with caution.


Something quick to try: change the format on the date variable to something like WEEKU5. ; This may allow the procedure to group data into a single week. Many of the analysis procedures will honor grouping based on a formatted value. If you try this you want to make sure that the width of the format is 5 or 6. Any longer will start allowing the day of the week issue you already have. If this works the ONLY change you may need to make would be adding a format statement like:

Format date weeku5.;

to your existing analysis.


Here is a brief example using a different analysis procedure:

data work.have;
   do day= 1 to 30;
      sales= round(100*rand('uniform'),0.01);
   format date date9.;

proc summary data=work.have nway;
   class date;
   format date  weeku5.;
   var sales;
   output out=work.summary (drop= _:) sum=;

Proc print data=work.summary;
  format date date9.;

The last is to show that the summary procedure grouped the data on the first day of the week (as available, I didn't provide a Dec 31 2017 for Sunday).


Note that there are three related formats WEEKU WEEKV and WEEKW that have slightly different interpretations of first day of week and how to treat week definition when the year changes.

And years do not have exactly 52 weeks, there is an extra  0.14 week in a typical year and 0.28 extra for leap years.

Obsidian | Level 7

You can use the same TIME ID (DAY), just change the interval to week. Forecast Studio shall automatically aggregate the data to weekly data for you.

Calcite | Level 5
Thanks, I had already figured that out on my own.



Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.


Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 


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
  • 3 replies
  • 3 in conversation