clu43 发表于 2010-4-29 00:29 
hhid year line income father mother
211101001 1989 1 8551.743
211101001 1991 1 6771.079
211101001 1993 1 11764.44
211101001 2000 2 10377.58
211101001 2000 3 12410.53 1 1
211101001 2000 3 12410.53 1 1
211101001 2000 2 13541.78
211101001 2000 2 10758.46
211101001 2000 3 12410.53 1 1
211101001 2000 3 12410.53 1 1
211101001 2000 1 10988.35
211101001 2000 2 12913.54
211101002 1989 1 7931.927
211101002 1991 2 5419.299
211101002 1991 1 5948.698
211101002 1991 2 4679.681
211101002 1991 3 1 1
211101002 1991 2 4859.36
211101002 1993 3 1 1
211101002 1993 1 6634.58
211101002 1993 3 1 1
211101003 1989 2 8427.104
211101003 1991 1 7706.991
211101003 1991 1 7706.991
211101003 1991 3 1 1
211101003 1993 3 1 1
211101003 1993 1 9048.201
211101003 1993 3 1 1
211101003 2000 1 7033.552
211101003 2000 3 1 1
211101003 2004 2 6521.96
仅对于你给出的以上数据,你是不是只要以下结果?
hhid year line income father mother
211101001 2000 1 12410.53 . .
211101001 2000 2 12410.53 . .
211101001 2000 2 12410.53 . .
211101001 2000 2 12410.53 . .
211101001 2000 2 12410.53 . .
****************************
sort hhid year line
by hhid year: egen p=sum((father==1|mother==1)&income<.)
by hhid year: egen c=sum(father==.&mother==.)
keep if p>0&c>0
g i=income if father==1|mother==1
by hhid year: egen t=max(i)
replace income=t
keep if i==.
drop p c i t