. gen elec=1 if hv206==1 . replace elec=0 if hv206==0 . gen water=1 if hv201==11 . replace water=1 if hv201==12 . replace water=1 if hv201==13 . replace water=1 if hv201==14 . replace water=1 if hv201==21 . replace water=1 if hv201==31 . replace water=1 if hv201==41 . replace water=1 if hv201==51 . replace water=1 if hv201==71 . replace water=0 if hv201==32 . replace water=0 if hv201==42 . replace water=0 if hv201==43 . replace water=0 if hv201==61 . replace water=0 if hv201==62 . replace water=0 if hv201==71 . replace water=0 if hv201==96 . gen toilet=1 if hv205==11 . replace toilet=1 if hv205==12 . replace toilet=1 if hv205==13 . replace toilet=1 if hv205==16 . replace toilet=1 if hv205==21 . replace toilet=1 if hv205==22 . replace toilet=1 if hv205==41 . replace toilet=0 if hv205==14 . replace toilet=0 if hv205==15 . replace toilet=0 if hv205==23 . replace toilet=0 if hv205==31 . replace toilet=0 if hv205==42 . replace toilet=0 if hv205==43 . replace toilet=0 if hv205==96 replace toilet=0 if hv205==71 . gen loc=0 if hv025==2 . replace loc=1 if hv025==1 . gen sex_hh=1 if hv219==1 . replace sex_hh=0 if hv219==2 . gen wq=5 if hv270==5 . replace wq=4 if hv270==4 . replace wq=3 if hv270==3 . replace wq=2 if hv270==2 . replace wq=1 if hv270==1 . gen sex_child=1 if hv104==1 . replace sex_child=0 if hv104==2 . rename hv024 reg . rename hv009 num_hh . rename hv005 weights . rename hv105 age_child drop if hv106==8 . gen edu_child=0 if hv106==0 . replace edu_child=1 if hv106==1 . replace edu_child=2 if hv106==2 . replace edu_child=3 if hv106==3 . gen edu_hh=1 if hheduc==1 . replace edu_hh=2 if hheduc==2 . replace edu_hh=3 if hheduc==3 . replace edu_hh=0 if hheduc==0 rename hv220 age_hh gen wgt=weights/1000000