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
Mediation: Direct effect greater than the Total effect !Dear all, i hope you are doing good in this period of Covid in my work i have studied the followin…
How to create a binary variable that identify whether another variable has duplicates in the dataset using Stata?*Please help me to delete this post because it is duplicated as above. Thank you! …
Interpret IRF scaleDear all, I have got an annual database with a short term interest rate in percent, a long term int…
How to create a binary variable that identify whether another variable has duplicates in the dataset using Stata?*The dataset is laid out in longitudinal format where the patient id (pid) is the first column, and t…
Stata histogram HelpHi, I'm attempting to find the 80th percentile of sales transaction totals in stata and graph it. I'…
Subscribe to:
Post Comments (Atom)
0 Response to compute mean of other observations
Post a Comment