I have a problem importing multiple CSV files (located in the same folder) to Stata (dta.) files. I've tried to use the following code:
** cd "D:\Data\Workdata\703987\CSV-filer"
clear
local myfilelist : dir . files"*.csv"
foreach file of local myfilelist {
drop _all
insheet using `file'
local outfile = subinstr("`file'",".csv","",.)
save "`outfile'", replace
}
**
But when I run the do-file, Stata gives an "invalid syntax" error-message?
Does anyone know what to do?
/Jonas
** cd "D:\Data\Workdata\703987\CSV-filer"
clear
local myfilelist : dir . files"*.csv"
foreach file of local myfilelist {
drop _all
insheet using `file'
local outfile = subinstr("`file'",".csv","",.)
save "`outfile'", replace
}
**
But when I run the do-file, Stata gives an "invalid syntax" error-message?
Does anyone know what to do?
/Jonas
Comment