Dear Statalisters,
i am trying to import 40 csv files into one dta file using import delimted and foreachloop. Each file has 2 variables, and they are the same variable for the 40 files. i run the code below, but it only imports one file. thanks in advance for your help


Code:
cd "/Users/aarredouani/Desktop/aa"
local list : dir "/Users/aarredouani/Desktop/aa" files "*.csv"
foreach f of local list {
import delimited "`f'"
save "`f'.dta", replace
append using "`f'.dta"

}

stata 15.1 mac