BookmarkSubscribeRSS Feed
Majid2023
Calcite | Level 5

Hi all,

I have a sample of 260 observations (52 weeks of sales for 5 items within two categories)

I would like to forecast weekly sales for each item for the next 4-6 week or forecast on weekly bases.

Is simple regression works here if yes how can I perform this task. 

Any help will be greatly appreciated.

 

Majid2023_0-1690112887294.png

 

7 REPLIES 7
PaigeMiller
Diamond | Level 26

I am extremely skeptical that a regression is a good tool to do this type of forecasting. I would think some time series model would work better. Nevertheless:

 

You need to add a record for weeks 53, 54, 55, 56, ... for each category and item to the data set, leaving sales as missing.

 

Then fit the regression using PROC REG with a BY statement (by category item;), and use the OUTPUT statement to ask for predicted values to be written to a SAS data set. The predicted values for weeks 53, 54, 55, 56, ... are the forecasts.

 

Here's a simple explanation, with code that would have to be modified for your actual application: https://blogs.sas.com/content/iml/2014/02/17/the-missing-value-trick-for-scoring-a-regression-model....

 

But really, you should be using a time series model.

--
Paige Miller
Majid2023
Calcite | Level 5

I like your idea of time series, Can you help with time series code for this data set? 

PaigeMiller
Diamond | Level 26

To tell you the truth, I cannot help with time series models, other than the most simple ones. Probably someone else can help with that.

--
Paige Miller
Majid2023
Calcite | Level 5

Thank you so much for sharing Regression code

PaigeMiller
Diamond | Level 26

You can also read the first 4 articles under Getting Started at this link https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/etsug/etsug_arima_toc.htm which is an example of forecasting sales.

--
Paige Miller
Ksharp
Super User
It is called panel data in time series analysis.
Better post it at Forecasting Forum:
https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/bd-p/forecasting_econometrics
Check PROC PANEL in SAS/ETS.

It is also called Longitudinal data in Clinic Data Analysis.
Check PROC MIXED or PROC GLIMMIX in SAS/STAT
https://blogs.sas.com/content/iml/2019/12/03/longitudinal-data-response-profile-model.html
https://blogs.sas.com/content/iml/2019/12/05/longitudinal-data-mixed-model.html

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1997 views
  • 0 likes
  • 3 in conversation