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: xttest2 errorHi, I am running a long panel (t=15, N=8), 8 countries and 15 years. after running for fe I ran the…
merge vars do not uniquely identify observations in master data - but no duplicates foundI am struggling to perform a 1:m merge on two merge variables that are both string variables. When I…
How to test goodness of fit in multinomial logistic regression having used the subpop rather than sub sample optionoptionHow do I test the goodness of fit for multinomial logistic regression, having used the subpop option…
Creating a Propensity Score Robustness Check TableHi, Does anyone know if there's a way to create a table like the attached image of different propen…
Help - Create Variable Indicating Percent who Agree or Strongly Agree by DepartmentHi, All, I have survey data with responses from individuals (n = 1077, some missing data), and thos…
Subscribe to:
Post Comments (Atom)
0 Response to gender changes in the panel survey
Post a Comment