*设原字符型变量是y(利用des可以省一行)
g x=y
d x
g n=.
forv i=1/`=r(width)'{
replace n=indexnot(x,"0123456789-.")
replace x=substr(x,1,n-1)+substr(x,n+1,.)
}
g z=real(x)
*省行
g x=y
d x
forv i=1/`=r(width)'{
replace x=substr(x,1,indexnot(x,"0123456789-.")-1)+substr(x,indexnot(x,"0123456789-.")+1,.)
}
g z=real(x)