Dear Statalist Community,
due to my thesis I am allowed to work with stata. My dataset comes from a Panelsurvey over several time periods, with round about 30000 individuals. It is not balanced. I got an issue where I am confronted with gender variance within the individual.
The problem here is not transsexuality, it proabably comes most of the times from misstakes. I think so, because the gender changes once in the middle of the individual survey period.
My nearest approach to solve my problem is the following:
bysort pid: gen syear_count = _N
gen gender_incons = 0
bysort pid (syear): replace gender_incons = 1 if gender != gender[_n-1] & gender != gender[_n+1] & syear_count >= 3
Here I at least detected those individuals, that change their gender several times. I have no clue how to tell stata how to fix this..
I think it needs to be something like:
bysort pid (syear): replace gender = gender[_n-1] if syear_count == 2
But here stata says "weights are not allowed".
I would also be very thankful about a maximum relative frequency command within the individuals gender. Something like replace gender = the maximum frequent gender value within the individual.
Can someone help me with my problem? I am getting more and more desperate.
Kind regards,
Moritz
Related Posts with gender changes in the panel survey
Panel Data/ Solom Four Group DesignHey there, I have panel data based on a salomon four group design (4 groups): 1. treatment and pre/…
Help with long data and counting unique variables by datesHi, I am in desperate need of help! I tried to show my data with dataex but given the size (25 mill…
Help me I m new with STATAHi! I m at the beginning of this software and I have to resolve this exercise. Can someone help me? …
Industry fixed effects in a dynamic panelHi, I want to include the industry fixed effects in a dynamic panel model based on the 2 digit sic …
Problem with #delimitI am unable to use the delimit command. Asking for help with Code: help delimit Gives the follow…
Subscribe to:
Post Comments (Atom)
0 Response to gender changes in the panel survey
Post a Comment