foreach i of num 1/14{
gen hindex_i'=da007_
i'_
recode hindex_i' 2=0 replace hindex_
i'=1 if da007_w2_1_i'_==1 & l.hindex_
i'==1
replace hindex_i'=1 if da007_w2_1_
i'==2 & l.hindexi'==1 & da007_w2_2_
i'==1
replace hindexi'=0 if da007_w2_1_
i'==2 & l.hindexi'==1 & da007_w2_2_
i'==2
replace hindexi'=1 if da007_w2_1_
i'==1 & l.hindexi'==0 & da007_w2_2_
i'==1
replace hindexi'=0 if da007_w2_1_
i'==1 & l.hindexi'==0 & da007_w2_2_
i'==2
replace hindexi'=1 if da007_w2_1_
i'==2 & l.hindex`i'==0
}
先给数据集设置时间变量