Hello Statalist,

Currently trying to append several CSV files into one on Stata (I understand the risk in doing this). All the files are located in one folder on my desktop.

I used the following code:

Code:
local filenames: dir "." files "*.csv"  

foreach f of local filenames {
import delim using `"`f'"', clear
gen source_file = `"`f'"'
append using `building'
save `"`building'"', replace
}
I then got the following error:

Code:
invalid file specification
r(198);
When I browed to see what had happened I saw that stata had imported the first dataset fine, but did not append the rest.

Any ideas on what I could do from here? Would greatly appreciate it!