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
Loop for specific range and store valueHello I am new to Stata. One of my assignment is to replicate Fama French 3. I did it in Matlab; how…
How to create an averaged scale from multiple variables?I would like to create an averaged scale created from five variables for each observation. Each of m…
Problems with an unbalanced panelWhilst declaring my panel and time variables in order to do the synthetic control method, (synth), m…
Redesigning dataset with categorical variableDear Statalist, I need a help with redesigning a dataset. It contains information on validity of co…
How to find the controls from a subset of cases in an already case-control matched sampleHi, I am new to this forum but have been using STATA for a while for very basic statistical analysis…
Subscribe to:
Post Comments (Atom)
0 Response to Mean of a group minus the observation's value in Panel data
Post a Comment