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
type mismatch in a regression with &Hello, When I run this regression : xi: areg z_educ i.stateid hhsize highest_maleeduc highest_femed…
import tfw or tif data on STATAHello, I am very new at geographic data analysis. I have the project to use tfw or tif datasets (NOA…
Can i have stationary and non-stationary variables together in a panel data model?I run a panel data model (N=5, T=17, unbalance). The depended variable is stationary while three of …
Margins and marginsplot command to estimate predicted values (adjusted predictions) with multiple categorical variablesDear Stata users, I am using the margins and marginsplot commands to generate wage-experience (grap…
Numbering Similar ObservationsHello, I'm having significant difficulty numbering observations. I've attached a screenshot for cla…
Subscribe to:
Post Comments (Atom)
0 Response to gender changes in the panel survey
Post a Comment