如果每个householdID就2行,
* Example generated by -dataex-. For more info, type help dataex
clear
input str10 householdID str12 ID byte ins
"0101041010" "010104101001" 4
"0101041010" "010104101002" 4
"0101041020" "010104102001" 1
"0101041020" "010104102002" 2
"0101041030" "010104103001" 4
"0101041030" "010104103002" 4
"0101041040" "010104104001" 2
"0101041040" "010104104002" 1
"0101041050" "010104105001" 1
"0101041050" "010104105002" 3
end
sort householdID ID ins
tostring ins,gen(ins1)
bysort householdID: gen id=ins1[1]+ins1[2]
list