Hi,
Suppose I have the following observations. I would like to calculate the sales average for each observation based on the weekly average value computed from the other channels. For example, for the first observation, this is channel 1 so I will compute the week sales average based on 10 (channel 2) + 6 (channel 3) from week 1 and divide by two. How can I write a code to do this for a larger dataset. Thanks.
Channel Sales Week Avg
1 3 1
1 9 2
2 10 1
2 2 2
3 6 1
3 15 2
Related Posts with compute mean of other observations
How to colour bars in a histogram or graph barHi there, I have been trying to colour individual bars in a histogram or graph bar with percentages…
Cross-lagged panel models with binary and continuous outcome variables: gsem or sem (?) + other questionsGreetings, I'm running Stata 15.1 on OSX and working with yearly panel data. My hypothesis predicts…
Overlapping-rolling windowDear Statalisters, I am running into an issue with rolling windows and I need your kind help with t…
problem installing using the ssc commandI am using Stata/MC 16.1 on Windows 10 (also had the same problem using Ubuntu Linux 18.04). I have…
What does 1.009e-12 mean?What does 1.009e-12 mean? Can you show it in a decimal expression? How to transfer it to decimal ex…
Subscribe to:
Post Comments (Atom)
0 Response to compute mean of other observations
Post a Comment