我写了一个小的例子,你可以看一下,主要是手动把里面的汉字年份改一下,
clear
input str7 time
"1个月"
"1年"   
"3"      
"5年"   
"6个月"
"七年" 
end
[/CODE]
gen indicator=strmatch(time,"*年")
gen indicator2=strmatch(time,"*月")
replace time=subinstr(time,"年","",.)
replace time=subinstr(time,"个月","",.)
tab time/12
手动将一些汉字改成数字
replace time="7" if time=="七"
destring time,replace
replace time=time/12 if indicator2==1