/******************************************************************** hier2.do Written by Russell Dimond 10/2002 for Intermediate Stata Class Second part of hier.do This part reads in both the individuals and the households. It then assigns a household number (hh) to each individual and drops the households. ********************************************************************/ clear capture log close set more off log using hier2,text replace infile using ind gen byte ishh=(type=="h") gen hh=sum(ishh) drop if ishh drop ishh drop type sort hh merge hh using hier1 tab _merge drop _merge save hier2,replace log close