I'm trying to append many files in Stata using loop. I've tried this answer: Stata: looping and appending
And below is my code.
clear
local pathdir "Data\RawData\edd"
local files: dir "`pathdir'" files "test_*.dta"
save "`pathdir'/master.dta", emptyok replace
foreach file in `files' {
use "`pathdir'/`file'", clear
append using "`pathdir'/master.dta"
save "`pathdir'/master.dta", replace
}
It just gives me empty space. I'm not really sure what to do. Why doesn't this work? Thank you for any help.
fileslist as empty, but won't tell you as much when running your loop.