My data is as now
What I want to get is the average of the price of each pool for each time value.
By command "bysort pool : egen price_avg = mean(price)" I only got the one average value of price over times (such as 2 for every values in pool j1.)
Instead of this, what command should I have to use?
code | pool | time | price | |
a1 | j1 | 20190101 | 1 | |
a1 | j1 | 20190102 | 2 | |
a1 | j2 | 20180101 | 1 | |
a1 | j2 | 20190101 | 1 | |
a2 | j1 | 20190101 | 2 | |
a2 | j1 | 20190102 | 3 | |
a2 | j2 | 20180101 | 1 |
pool | time | price_avg |
j1 | 20190101 | |
j1 | 20190102 | |
j2 | 20180101 | |
j2 | 20190101 |
Instead of this, what command should I have to use?
Comment