I've tried to run this code multiple times with many adjustments, I also tried the solutions to similar problems with the subinstr() invalid syntax, but these don't seem to work. Can anyone tell me where my mistake lies?
Code:
local csvfiles : dir "input" files "*.csv"
foreach file of local csvfiles {
import delimited `"input/`file'"', clear delimiters(",") varnames(1)
local name : subinstr("`file'", ".csv" , "", .)
save `"output/`name'.dta"', replace
}
0 Response to Subinstr() returns "invalid syntax" within foreach loop
Post a Comment