楼主: simply111
18287 18

如何将几百个数据文件批量导入stata? [推广有奖]

11
wang91utk2017 发表于 2016-12-3 11:50:56

12
tangs11 发表于 2018-11-7 22:13:50
johnayl 发表于 2010-5-13 10:38
as wei-luo said.

here are the steps:
谢谢楼主,万分感谢

13
sas粉 发表于 2018-12-11 14:58:09
johnayl 发表于 2010-5-13 10:38
as wei-luo said.

here are the steps:
务必需要注意指针符号,`在1的左边,’在:的右边,折磨了我一下午的发现,请大家注意~~~

14
sas粉 发表于 2018-12-11 14:59:34
johnayl 发表于 2010-5-13 10:38
as wei-luo said.

here are the steps:
`在1的左边,’在:的右边

15
lihujiejie 发表于 2022-2-16 21:16:55
johnayl 发表于 2010-5-13 10:38
as wei-luo said.

here are the steps:
你好,使用这个循环只能存入f1为stata 文件,后面会出现you must start with an empty dataset,怎么处理,谢谢

16
半颗青橙 学生认证  发表于 2022-3-20 15:47:49
johnayl 发表于 2010-5-13 10:38
as wei-luo said.

here are the steps:
在批量转换文件格式的forvalues循环中,按照层主给出的原命令run会出现错误提示:you must start with an empty dataset。解决办法是在循环的最后一行加个clear:

forv i=1/1800 {
    insheet using C:\temp\f`i'.csv
    save c:\temp\f`i'.dta, replace
    clear
}

17
半颗青橙 学生认证  发表于 2022-3-20 15:48:42
lihujiejie 发表于 2022-2-16 21:16
你好,使用这个循环只能存入f1为stata 文件,后面会出现you must start with an empty dataset,怎么处理 ...
在循环的最后加一行clear就可以啦~

18
lihujiejie 发表于 2022-3-25 17:40:11
半颗青橙 发表于 2022-3-20 15:48
在循环的最后加一行clear就可以啦~
谢谢,我试一下。

19
OWilu 发表于 2024-2-22 22:09:49
johnayl 发表于 2010-5-13 10:38
as wei-luo said.

here are the steps:
第二步要加个clear,否则出现报错【you must start with an empty dataset】
2. use forvalues:

forv i=1/1800 {
    insheet using C:\temp\f`i'.csv, clear
    save c:\temp\f`i'.dta, replace
}


您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-29 04:16