我的每份csv都长这个样子:
id location price squarefeet
1.
2.
我需要将每一天的csv都append到一个dta里面,作面板数据。
我现在的command是这个样子,但是出现的错误信息是unexpected end of file? 不知道哪里出现问题了,有人帮忙纠正一下吗
cd "C:\Users\Documents\RA craigslist"
cap log using cox.log, text replace
* -combine panel data, csv folder with all .csv in the firectory
filelist , dir("csv") pattern(*.csv) save("csv_datasets.dta") replace //filelist external command
use "csv_datasets.dta", clear
local obs = _N
forvalues i=1/`obs' {
use "csv_datasets.dta" in `i', clear
local f = dirname + "/" + filename
insheet using "`f'", clear
gen source = "`f'"
tempfile save`i'
save "`save`i''"
}
use "`save1'", clear
forvalues i=2/`obs' {
append using "`save`i''"
}
append using "`save`i''"
}