Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to generate group mean variables for each time?

    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 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?
    Last edited by Sue Lee; 22 May 2019, 12:42.

  • #2
    Code:
    bysort pool time :

    Comment


    • #3
      Thank you so much!

      Comment

      Working...
      X