I want to create four separate dummy variables at household level:
1. No children between 5 and 16 years old in the household
2. All children between 5 and 16 years old are attending school
3. Only some children between 5 and 16 years old are attending school
4. None of the children between 5 and 16 years old are attending school
Following is the data on age and education of each household member.
Code:
clear input double hhid float age float yrsedu 101000 50 0 101000 41 0 101000 14 7 101000 17 0 101000 8 0 102000 50 0 102000 42 0 102000 14 7 102000 14 5 102000 18 8 103000 4 0 103000 20 8 103000 28 8 104000 8 0 104000 15 0 104000 29 10 104000 30 10 end label var yrsedu "Years of Education"
Code:
gen all5to16_sch=0 by hhid: replace all5to16_sch=1 if inrange(age, 5,16) & years_edu !=0
0 Response to create dummy variables for children education
Post a Comment