我有识别号码,例如7612245235086,我需要从CSV文件导入Stata。
当我导入它们时,它们最终会以科学记数法形式出现。
如何导入它们但将它们保留为文本值?
答案 0 :(得分:1)
这可以通过stringcols()
命令的import delimited
选项来完成:
tempname myfile
file open `myfile' using "example.csv", write text replace
file write `myfile' "7612245235086" _n
file write `myfile' "8612245235087" _n
file write `myfile' "9612245235088" _n
file close `myfile'
import delimited using example.csv, clear
list
+-----------+
| v1 |
|-----------|
1. | 7.612e+12 |
2. | 8.612e+12 |
3. | 9.612e+12 |
+-----------+
import delimited using example.csv, clear stringcols(_all)
list
+---------------+
| v1 |
|---------------|
1. | 7612245235086 |
2. | 8612245235087 |
3. | 9612245235088 |
+---------------+
erase example.csv