/* Single family: a woman alone taking care of biological children Nuclear family: a woman staying with her husband alone or with children Extended family: a woman alone or with her husband taking care of children including other members like grandmother, uncle, aunt, grandson etc. hv101 codes: 1 head 2 wife or husband 3 son/daughter 4 son/daughter-in-law 5 grandchild 6 parent 7 parent-in-law 8 brother/sister 9 co-spouse 10 other relative 11 adopted/foster/stepchild 12 not related 13 niece/nephew 98 don't know open a PR file */ keep hv000-hv002 hv101 hv104 hv105 * construct binary (0/1) codes for each type of person gen ft_1=0 gen ft_1_m=0 gen ft_1_f=0 gen ft_2=0 gen ft_2_m=0 gen ft_2_f=0 gen ft_3=0 gen ft_4=0 gen ft_5=0 gen ft_6=0 gen ft_7=0 gen ft_8=0 gen ft_9=0 gen ft_10=0 gen ft_11=0 gen ft_12=0 gen ft_13=0 replace ft_1=1 if hv101==1 replace ft_1_m=1 if hv101==1 & hv104==1 replace ft_1_f=1 if hv101==1 & hv104==2 replace ft_2=1 if hv101==2 replace ft_2_m=1 if hv101==2 & hv104==1 replace ft_2_f=1 if hv101==2 & hv104==2 replace ft_3=1 if hv101==3 replace ft_4=1 if hv101==4 replace ft_5=1 if hv101==5 replace ft_6=1 if hv101==6 replace ft_7=1 if hv101==7 replace ft_8=1 if hv101==8 replace ft_9=1 if hv101==9 replace ft_10=1 if hv101==10 replace ft_11=1 if hv101==11 replace ft_12=1 if hv101==12 replace ft_13=1 if hv101==13 collapse (sum) ft_*, by(hv001 hv002) * in the collapsed file, these variables will give the number of people within each household who are of each type * now construct household types based on combinations of the presence or absence of each type of person * in the following example I do not take account of the age of the person, which could be important! gen ft=. gen relatives=ft_5>0+ft_6+ft_8+ft_10+ft_13 replace ft=1 if (ft_1_f==1 & ft_2_m==0) & ft_3>0 & ft_4==0 & ft_5==0 & ft_6==0 & ft_7==0 & ft_8==0 & ft_9==0 & ft_10==0 & ft_11==0 & ft_12==0 & ft_13==0 replace ft=2 if (ft_1==1 & ft_2==1) & ft_3>=0 & ft_4==0 & ft_5==0 & ft_6==0 & ft_7==0 & ft_8==0 & ft_9==0 & ft_10==0 & ft_11==0 & ft_12==0 & ft_13==0 replace ft=3 if (ft_1==1 & ft_2==1) & ft_3>0 & relatives>0 & ft_4==0 & ft_7==0 & ft_9==0 & ft_11==0 & ft_12==0 drop ft_* relatives label define ft 1 "Single" 2 "Nuclear" 3 "Extended" label values ft ft label variable ft "Family type" tab ft, m