BookmarkSubscribeRSS Feed
kmin87
Fluorite | Level 6

Hello I am trying to predict the sales for each of the locations in the data base. The data has months and each location has sales numeric value for that respective month. I'm trying to create a linear predictive model and predict the next sales data for the next three months for each location. 

would anyone assist?

DATA JOB;
INPUT Month HI CA NY WA TX;
DATALINES;
1 75 100 90 88 78
2 51 85 88 89 71
3 99 96 94 93 85
4 92 106 84 84 67
5 90 89 83 77 69
6 67 77 83 73 65
7 109 67 71 65 50
8 94 112 105 91 107
9 105 110 99 95 96
10 74 102 88 69 63
11 64 122 68 79 73
12 76 132 89 80 77
13 86 122 99 90 75
14 111 65 90 80 30
;
RUN;
2 REPLIES 2
PaigeMiller
Diamond | Level 26

Show us what you have tried.

--
Paige Miller
Rick_SAS
SAS Super FREQ

This sounds like an assignment, so let me offer a few suggestions rather than give a complete answer:

1. I think your analysis will be simpler if you first convert the data from wide form (5 Y variables) to long form (a variable named State with values "HI" .. "TX" and a variable named Sales that contains the values).   If this sounds difficult, an alternative is to run a regression procedure 5 times, once for each state.

2. If you convert the data to long form, then
Use your favorite SAS regression procedure to analyze the data. You can use the State variable as a BY variable (if you are not interested in comparing different states to each other) or as a CLASS variable (if you want to compare  how sales are rising in HI compared to TX, for example).  I suggest initially using a BY variable. Either use PROC GLM or PROC REG.

3. For each model, you will get a set of parameter estimates (slope and intercept). Use those estimates to predict the sales at Month=17.  If you want to get fancy, SAS provides several ways to "score" (which means predict) new values in a regression model. 

 

Getting the models are the first step, so concentrate on that task. When you have succeeded, post your code if you need additional hints.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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