Mariarosaria,
First, change the path delimiter from a backward slash to a forward
slash. In other words, instead of c:\data\ write c:/data/.
Second, are you sure that each observation appears only once across
all 66 datasets? Run your merge and note the number of observations in
the final file. Then add up the observations across the 66 files with
the following commands. If the result is different you confirmed that
at least one file is appended more than once. If the result is
identical, the observations are not unique across the 66 files.
local filelist: dir "c:/data/" files "v*.dta"
local n = 0
foreach file of local filelist {
describe using "c:/data/`file'", short
local n = `n' + r(N)
}
di `n'
Friedrich
On 6/11/07, [email protected] <[email protected]> wrote:
Dear all,
I have a problem when I append a list of files (named from v2.dta to v66.dta)
to the current dataset (v1.dta). Incidentally, all these files contain the
same variables, in the same order.
The command I use is the following:
**************************************
use c:\data\v1
forvalues i = 2(1)66 {
append using "c:\data\v`i'"
}
**************************************
when I look at the data in the resulting dataset many observations are
duplicated, as Stata had appended twice the same file. I have also tried to
use the alternatives:
**************************************
foreach file in v2.dta v3dta v4.dta…….v66.dta {
append using "`file'"
}
**************************************
and:
**************************************
local i = 1
use c:\data\v`i', clear
while `i'<=66 {
append using c:\data\v`i'
local i = `i' + 1
}
**************************************
but I always get the same strange result.
Thank you in advance for any suggestions
Mariarosaria
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/