Dear all,
I am trying to import a folder with .csv files to stata. Each file corresponds to a month of data, and they cover the period January 2013 to December 2020.
I am using the following code:
clear all
cd "${folder}"
local satafiles: dir . files "*.csv"
foreach file of local satafiles {
preserve
import delimited using "`file'", clear
save temp,replace
restore
append using temp
}
rm temp.dta
save "${folder}dataset", replace
clear all
However, I get the error "temp.dta not found".
Is there any typo/mistake in the code?
If someone could help, that would be great! Thanks!
0 Response to Import a folder with .csv files
Post a Comment