Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Puzzling error with merge
From
David Hoaglin <[email protected]>
To
[email protected]
Subject
Re: st: Puzzling error with merge
Date
Tue, 14 Jan 2014 19:30:18 -0500
Hi, Marcos.
Thank you for the suggestions.
The cause of my problem was extra blank rows in the first sheet of the
Excel file. When I imported that sheet, the value of the key variable
(a string) was blank, and the values of the other variables were coded
as missing. All of those extra rows had the same value of the key
variable, so -merge- gave the error message about duplicate values.
I did not encounter a problem with the way that the variables in the
non-extra rows were written, and the only variable common to the two
sheets was the key variable.
I had already imported the second sheet into a Stata file, without
dropping the first row.
Merging files presents a variety of opportunities to go wrong. I was
relieved that the solution was simple this time.
Regards,
David Hoaglin
On Tue, Jan 14, 2014 at 1:28 PM, Marcos Almeida <[email protected]> wrote:
> Hi , David,
>
> I guess the solution for your problem could be:
>
> 1. First, still working in Excel, be sure all the variables are
> written the same way and format, as well as in the same sequence in
> both spreadsheets.
>
> 2. Then, drop the first line (the one with the names of the variables)
> of the second spreadsheet.
>
> 3. Finally, proceed with the merging, be it on Excel or Stata.
>
> Once I had a similar problem, and that was the way I did to fix it.
>
> I hope that helps!
>
> Best,
>
> Marcos Almeida
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/