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!
Related Posts with Mean of a group minus the observation's value in Panel data
How to create new columns for each country observation and count this number of countries?Dear all, I wanted your help with the following. I am working on a patent project and in the follow…
putexcelDear All, I nested putexcel into a loop. I need to estimate the same model for 500 assets and i wou…
Cross sectional dependence for firm panel dataDo we conduct a cross sectional dependence test for panel data with N being listed firms and T being…
Keep variable1 if 1 observation per year OR*the minimum number for a variable2 if > 1 observations per yearNeed help! My goal is to write code to keep a single HbA1c value per year closest to each participan…
Combine histogram and connected line graph over timeDear Statalist forum users, I came across this graph in a published paper and want to produce a simi…
Subscribe to:
Post Comments (Atom)
0 Response to Mean of a group minus the observation's value in Panel data
Post a Comment