BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nolanmb
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

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Puwang
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

3 REPLIES 3
ballardw
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;
      date=mdy(1,day,2018);
      sales= round(100*rand('uniform'),0.01);
      output;
   end;
   format date date9.;
run;

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

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

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.

Puwang
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.

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 768 views
  • 0 likes
  • 3 in conversation