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
Linear state spaceI have been largely benefited from this forum every time I post a question or I am looking for a que…
how to calculate the standard deviation for many variables in STATADear all, I am trying to calculate the standard deviation for 14 variables ( Q1, Q2,,Q14) and I use …
Recode a variable to the same previous value by categoryDear community, SOS! I have a panel data containing household information that was collected mainl…
xml_tab error messageDear All, I estimate different panel data models and then I try to export the results to excel usin…
coefplot: how to fix the scaling for different coefficients?!Hi I am not getting a clear figure with coefplot. I think the problem is that the coefficients and …
Subscribe to:
Post Comments (Atom)
0 Response to Mean of a group minus the observation's value in Panel data
Post a Comment