Hi all,
I have around 300 files which need to be merged into one. The files are all in the same folder as my do file and are called 1.dta, 2.dta, 3.dta etc. I tried to merge the files with the code below:
as suggested in here. with this code i'm getting a invalid 'filename' error back from stata.
Could one of you help me solve this problem? Thanks!
Tristan
I have around 300 files which need to be merged into one. The files are all in the same folder as my do file and are called 1.dta, 2.dta, 3.dta etc. I tried to merge the files with the code below:
Code:
clear all global dir "C:\directory\stata data" local myfilelist : dir "." files "*.dta" foreach filename of local myfilelist { use 'filename', clear merge 1:1 date using "$dir\1" drop _merge save "$dir\1", replace }
Could one of you help me solve this problem? Thanks!
Tristan
Comment