Announcement

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

  • Mean of a group minus the observation's value in Panel data

    Hi,

    I have a data structure like this:

    IO-IOarea-Year-index
    1----4-------1997-0
    2----4-------1998-2.2267373
    3----5-------1998-0
    4----5-------2000-0

    I would create a mean of index variable for each IOarea group per year. So I used this code:
    by IOarea Year, sort: egen index_byissue=mean(index)

    However, now I would like to add a second step where I show the mean of the group minus that IO's score per year. So each IO get the score of index_byissue minus its own score each year. I aim to use other group members' average score each year as a new variable.

    ​​​​​​​Thanks so much by now!



  • #2
    Often discussed here. See FAQ on results for other members of a group on the Stata website and also rangestat or asrol from SSC.

    Comment

    Working...
    X