Michael,
Thank you for your suggestion.
Following your suggestion, I modified the original codes as
follows:
foreach file in sysdsn32 sysdsn33 sysdsn34 {
use `file'
sort patid
tempfile `file'_temp
save ``file'_temp'
use sysdsn31
sort patid
capture drop _merge
merge patid using "`file'_temp"
save sysdsn31, replace
}
But when running these codes, I got an error, saying
file sysdsn32_temp.dta not found
r(601);
What would be the problem?
Or there may be any misunderstanding in my modification.
Any suggestions welcome.
Thanks in advance.
K.I.