use LSPR60FL.DTA, clear generate weight= hv005/1000000 svyset [pw=weight], psu(hv021) strata(hv022) * sort to ensure that the household listing is in order sort hhid hvidx *Living arrangements of children recode hv114 (0=0 "Not present") (1/30 = 1 "Present") (.=0), gen(father_presence) recode hv112 (0=0 "Not present") (1/30 = 1 "Present") (.=0), gen(mother_presence) replace father_presence=9 if inrange(hv113,8,9) replace mother_presence=9 if inrange(hv111,8,9) * need to take into acount whether father or mother usually live in the household replace father_presence=0 if father_presence==1 & hv102[_n-hvidx+hv114] != 1 replace mother_presence=0 if mother_presence==1 & hv102[_n-hvidx+hv112] != 1 * gen parental_presence = 9 replace parental_presence = 1 if father_presence == 1 & mother_presence == 1 replace parental_presence = 2 if father_presence == 1 & mother_presence == 0 replace parental_presence = 3 if father_presence == 0 & mother_presence == 1 replace parental_presence = 4 if father_presence == 0 & mother_presence == 0 label var parental_presence parental_presence label define parental_presence 1 "Both" 2 "Father only" 3 "Mother only" 4 "None" 9 "DK/Missing" label val parental_presence parental_presence svy:tab parental_presence if hv102==1 & hv105 <= 17