I'd like to regress an employment model. I have variables and datasets as shown below. hhid14 is the household's ID, and pidlink is the individual id within the household.
I want to create new dummy variables containing the number of household members by age categories: 0-9; 10-14; 15-24; 25-45; 46-65; and >=66 years. In addition, I also want to make the variables for the number of household members who are: females aged above15 years; the number of members with the highest education level for no schooling, junior high, senior high, and postgraduates (post14); and finally the number of household members aged 15-21 years who are still in school. All of these variables are calculated excluding the corresponding respondent. Can anyone help me with the Stata syntax for this? Thank you in advance.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str8 hhid14 str10 pidlink double(sex ageyr no_school14 junior14 senior14 post14 attn_sch14 work15) "0012451" "001240005" 0 37 1 0 0 0 3 1 "0012451" "001245101" 1 50 0 0 0 0 3 1 "0012451" "001245103" 1 21 0 0 0 1 1 1 "0012451" "001245104" 0 18 0 1 0 0 1 1 "0012451" "001245105" 0 13 0 0 0 0 1 1 "0012451" "001245106" 0 11 0 0 0 0 1 1 "0012451" "001245107" 0 7 1 0 0 0 1 3 "0012452" "001240009" 0 24 0 1 0 0 3 1 "0012452" "001245201" 1 30 0 1 0 0 3 1 "0012452" "001245203" 1 8 0 0 0 0 1 3 end label values sex sex label def sex 0 "0.F", modify label def sex 1 "1.M", modify
0 Response to create variables for number of hh member by categories
Post a Comment