黃河泉 发表于 2018-5-20 16:52 
我的作法是对的,要吗是你没讲清楚,或是你的资料有问题 (为什么 householdID 都是空的?)!
老师,按照那个命令运行下来,householdID就不见了,我也不知道是哪里的问题,是不是我给的数据不够多或者还需要其他的变量,您能不能再看看,非常感谢!clear
input str12 ID str10 householdID float tudi
"010104101001" "0101041010" .
"010104101002" "0101041010" 1
"010104102001" "0101041020" 0
"010104102002" "0101041020" .
"010104103001" "0101041030" .
"010104103002" "0101041030" 0
"010104104001" "0101041040" 1
"010104104002" "0101041040" .
"010104105001" "0101041050" .
"010104105002" "0101041050" 0
"010104106001" "0101041060" 1
"010104107001" "0101041070" .
"010104107002" "0101041070" 1
"010104108001" "0101041080" .
"010104108002" "0101041080" 1
"010104109001" "0101041090" .
"010104109002" "0101041090" 1
"010104110001" "0101041100" 1
"010104110002" "0101041100" .
"010104111001" "0101041110" 0
"010104112001" "0101041120" 1
"010104112002" "0101041120" .
"010104113001" "0101041130" 1
"010104113002" "0101041130" .
"010104114001" "0101041140" 1
"010104114002" "0101041140" .
"010104115001" "0101041150" .
"010104115002" "0101041150" 1
"010104116001" "0101041160" 1
"010104116002" "0101041160" .
"010104117001" "0101041170" .
"010104117002" "0101041170" 1
"010104118001" "0101041180" 1
"010104118002" "0101041180" .
"010104119001" "0101041190" 1
"010104119002" "0101041190" .
"010104120001" "0101041200" .
"010104120002" "0101041200" 1
"010104121001" "0101041210" .
"010104121002" "0101041210" 0
"010104122001" "0101041220" .
"010104122002" "0101041220" 1
"010104123001" "0101041230" 1
"010104124001" "0101041240" .
"010104124002" "0101041240" 1
"010104125001" "0101041250" .
"010104125002" "0101041250" 1
"010104126001" ""           .
"010104127001" "0101041270" .
"010104127002" "0101041270" 1
"010104128001" "0101041280" .
"010104128002" "0101041280" 1
"010104129001" "0101041290" .
"010104129002" "0101041290" 1
"010104130001" "0101041300" 1
"010104130002" "0101041300" .
"010104201001" ""           .
"010104201002" "0101042010" 1
"010104203001" ""           .
"010104203002" ""           .
"010104204001" ""           .
"010104205001" "0101042050" .
"010104205002" "0101042050" 1
"010104206001" "0101042060" .
"010104206002" "0101042060" 0
"010104207001" ""           .
"010104207002" ""           .
"010104208001" "0101042080" 0
"010104209001" ""           .
"010104210001" "0101042100" 0
"010104212001" "0101042120" 0
"010104217001" "0101042170" 0
"010104217002" "0101042170" .
"010104218002" "0101042180" 0
"010104219001" ""           .
"010104220001" "0101042200" 1
"010104221001" "0101042210" 0
"010104221002" "0101042210" .
"010104222001" ""           .
"010104222002" ""           .
"010104223001" "0101042230" 0
"010104224001" ""           .
"010104225001" "0101042250" .
"010104225002" "0101042250" 0
"010104226001" "0101042260" .
"010104226002" "0101042260" 0
"010104227001" "0101042270" 0
"010104228001" ""           .
"010104228002" "0101042280" 1
"010104229001" ""           .
"010104229002" ""           .
"010104230001" "0101042300" 0
"010104231001" "0101042310" 0
"010104231002" ""           .
"010104232001" "0101042320" 0
"010104233001" ""           .
"010104233002" ""           .
"010104234001" "0101042340" .
"010104234002" "0101042340" 0
"010104235001" ""           .
end
[/CODE]
------------------ copy up to and including the previous line ------------------
Listed 100 out of 23448 observations
Use the count() option to list more