我有多个文本文件要导入stata并将它们一起附加到一个文件中。文件命名为rwdata_1,rwdata2等。我正在使用此处描述的方法https://stats.idre.ucla.edu/stata/faq/how-can-i-combine-a-large-number-of-files/
clear all
set more off, permanently
set memory 1000m
cd "H:\...\Data\Raw Data"
! dir *.txt /a-d /b > "H:\...\Data\rwdata_filelist.txt", replace
file open filelist using "H:\...\Data\rwdata_filelist.txt", read
file read filelist line
drop _all
insheet using `line', tab names
save `line'.dta, replace
save rwdatapanel_es.dta, replace
drop _all
file read filelist line
while r(eof)==0 {
insheet using `line', tab names
save `line'.dta, replace
append using rwdatapanel_es.dta
save rwdatapanel_es.dta, replace
drop _all
file read filelist line
}
错误消息:(注意:找不到文件rwdata_10.txt.dta) 该算法创建并保存单个和附加文件,但保存的文件不包含任何数据。谁能告诉我可能是什么问题?