My panel data set has three different variables and I must do a similar treatment on them, they are multiple response. One of the variables look like this:
Code:
clear input byte(ch016_1 ch016_2 ch016_3 ch016_4 ch016_5 ch016_6 ch016_7 ch016_8 ch016_9 ch016_10 ch016_11 ch016_12) 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 5 2 . . . . . . . . . . 2 . . . . . . . . . . . 2 . . . . . . . . . . . 1 2 . . . . . . . . . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 1 1 1 . . . . . . . . . 2 1 . . . . . . . . . . 2 1 . . . . . . . . . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 1 6 1 1 . . . . . . . . 1 4 4 1 . . . . . . . . 1 1 1 . . . . . . . . . 1 2 1 . . . . . . . . . 1 1 2 . . . . . . . . . 1 1 1 . . . . . . . . . 1 1 1 . . . . . . . . . 1 1 1 . . . . . . . . . 8 1 1 .b . . . . . . . . 7 1 7 .b . . . . . . . . 5 3 . . . . . . . . . . 4 3 . . . . . . . . . . 2 . . . . . . . . . . . 2 . . . . . . . . . . . 9 . . . . . . . . . . . 2 1 2 1 . . . . . . . . 1 1 1 1 . . . . . . . . 1 1 1 1 . . . . . . . . 1 2 . . . . . . . . . . 9 1 . . . . . . . . . . 9 1 . . . . . . . . . . 7 2 . . . . . . . . . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 1 6 . . . . . . . . . . 1 1 . . . . . . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . . 1 . . . . 1 . . . . . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 6 1 1 1 . . . . . . . . 6 1 1 1 . . . . . . . . 1 1 1 . . . . . . . . . 1 1 1 . . . . . . . . . 1 1 1 . . . . . . . . . 6 1 . . . . . . . . . . 2 5 . . . . . . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . . 2 2 6 . . . . . . . . . 3 2 3 . . . . . . . . . 2 3 2 . . . . . . . . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 2 . . . . . . . . . . . 1 . . . . . . . . . . . 1 1 1 . . . . . . . . . 1 1 2 . . . . . . . . . 1 . . . . . . . . . . . 1 . . . . . . . . . . . 3 1 3 5 . . . . . . . . 3 1 3 5 . . . . . . . . 1 1 1 1 . . . . . . . . 1 2 1 . . . . . . . . . 1 1 1 3 . . . . . . . . 8 7 1 . . . . . . . . . 8 7 2 . . . . . . . . . 7 2 8 . . . . . . . . . 2 1 . . . . . . . . . . 2 6 1 . . . . . . . . . 2 5 1 . . . . . . . . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . 6 3 2 1 . . . . . . . . 3 1 2 1 . . . . . . . . 2 3 1 1 . . . . . . . . 1 3 1 1 1 1 . . . . . . 8 1 1 . . . . . . . . . 7 3 1 . . . . . . . . . 7 1 1 . . . . . . . . . 2 8 8 1 4 . . . . . . . 2 97 97 1 97 . . . . . . . 97 8 97 1 4 . . . . . . . 1 1 1 . . . . . . . . . 1 1 1 . . . . . . . . . 1 1 1 . . . . . . . . . end label values ch016_1 ch016 label values ch016_2 ch016 label values ch016_3 ch016 label values ch016_4 ch016 label values ch016_5 ch016 label values ch016_6 ch016 label values ch016_7 ch016 label values ch016_8 ch016 label values ch016_9 ch016 label values ch016_10 ch016 label values ch016_11 ch016 label values ch016_12 ch016 label def ch016 1 "Full-time employed", modify label def ch016 2 "Part-time employed", modify label def ch016 3 "Self-employed or working for own family business", modify label def ch016 4 "Unemployed", modify label def ch016 5 "In vocational training/retraining/education", modify label def ch016 6 "Parental leave", modify label def ch016 7 "In retirement or early retirement", modify label def ch016 8 "Permanently sick or disabled", modify label def ch016 9 "Looking after home or family", modify label def ch016 97 "Other", modify Listed 100 out of 40569 observations Use the count() option to list more
"full-time" "part-time" "self-employed" "unemployed" "parental leave" for at least one child from the respondent's perspective,
into a regression. I might suggest that "full-time" and "self-employed" can be coded together.I would like to turn this sentence into a loop "
if ID 4 has 5 children who all have different occupations, I would like to know the occupation for at least one child, among the alternatives I just stated"
I have tried to use mrtab and egen, anymatch but it doesn't really do what I am looking for, they count the frequencies and generate a new variable which created a dummy trap in my previous regression and also collinearity.
For other variables I have a similar question "for at least one child" in a multiple response, so I was hoping that with one code from the forum I could use for the others.
Thanks
0 Response to Recoding variables with a loop - 2020 challenge
Post a Comment