My data is as now
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
What I want to get is the average of the price of each pool for each time value.
pool time price_avg
j1 20190101
j1 20190102
j2 20180101
j2 20190101
By bysort pool : egen price_avg = mean(price), I only get 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?