Hi,

I am merging multiple files in a folder, using the code below.
the master file (named PED_DAY_ALL.dta) only contains the last file in the folder (whatever file with the name comes the last in the alphabetical order), not the result of the merge.
Would you recommend solution?



Code:
cd D:\WORK\DATA\GEOVISION_2021\WORKING\PED_DET\DAY_DT A
local allfiles2 : dir "D:\WORK\DATA\SKT_GEOVISION_2021\WORKING\PED_DET\D AY_DTA" files "seo_flow_wkdy_*.dta"
display `allfiles2'

foreach file in `allfiles2' {
use `file', clear
merge 1:1 XYCOORD using `file', nogen
}
save PED_DAY_ALL.dta, replace