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
Taking the sum of some observationsHi all, I have a question. I have a dataset like the left table in my screenshot (small example). I…
coefplot rdrobust combinationDear STATAlists, I am trying to add on x-axes ticks and labels in order to have for each line one t…
Graph label while using "ciplot" commandDear All, Here is my data. It is in wide form (survey data). For instance I will use Vitamin D vari…
Time seriesI use ID as a symbol for the company I use, each company has more than 1 event with different dates.…
To convert 'blue digit ' column into 'black digit' column (string to normal variable)Hi. I am using a data set which contains more than 600,000 observations on household expenditure. T…
Subscribe to:
Post Comments (Atom)
0 Response to gender changes in the panel survey
Post a Comment