条条大路通罗马,为何不尝试一下别的函数或方法?
*-
http://www.pinggu.org/bbs/thread-992988-1-1.html
clear
input double city int ind
1101010303 4
110101002102 2
353656647 7
end
*format city %20.0f
gen city_str1 = string(city, "%20.0g")
*tostring city, gen(city_str1)
gen city_str2 = reverse(city_str1)
gen city_3 = real(substr(city_str2,1,1))
gen match = (city_3==ind)
list, noobs clean
| city | ind | city_str1 | city_str2 | city_3 | match |
| 1.101e+09 | 4 | 1101010303 | 3030101011 | 3 | 0 |
| 1.101e+11 | 2 | 110101002102 | 201200101011 | 2 | 1 |
| 3.537e+08 | 7 | 353656647 | 746656353 | 7 | 1 |