Bookmark and Share

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: Re: Unexpected results with merge with update option


From   Robert Picard <[email protected]>
To   [email protected]
Subject   Re: st: Re: Unexpected results with merge with update option
Date   Wed, 25 May 2011 13:09:57 -0400

Thanks Nick for digging out my old post.

I did not get any replies on Statalist so the issue was raised with
Stata Technical Support. The rather long reply tried to explain that
this was a "feature" and that the -update- option was working as
expected. What's missing in my original post is the output I was
getting (using Stata/MP 11.0 at the time):

+-----------------------------------------+
 | id   x1   seq                    _merge |
 |-----------------------------------------|
 |  1    .     1               matched (3) |
 |  1   22     2       missing updated (4) |
 |  1   33     3       missing updated (4) |
 |  1   44     4       missing updated (4) |
 |-----------------------------------------|
 |  2   11     1       missing updated (4) |
 |  2   11     2               matched (3) |
 |  2   11     3   nonmissing conflict (5) |
 |  2   11     4   nonmissing conflict (5) |
 +-----------------------------------------+

If I try my example on Stata/MP 11.2, I get:

 +-------------------------------------+
  | id   x1   seq                _merge |
  |-------------------------------------|
  |  1    .     1           matched (3) |
  |  1   22     2   missing updated (4) |
  |  1   33     3   missing updated (4) |
  |  1   44     4   missing updated (4) |
  |-------------------------------------|
  |  2   11     1   missing updated (4) |
  |  2    .     2           matched (3) |
  |  2   33     3   missing updated (4) |
  |  2   44     4   missing updated (4) |
  +-------------------------------------+

which is what I was expecting in the first place. So it looks like
this issue is "fixed" in the current version. Perhaps the Stata/MP
11.1 you are using is slightly older than the other ones you have
tried this on. You can find the born date by typing -about-.

I should note that I did not follow-up on this with Tech Support
because I had a second look at my code (not the fake one I posted to
illustrate the problem) and determined that using the -update- option
did not make sense with a 1:m merge. That's because if x1 is a
variable in the master, then its values should be constant within id
groups after the 1:m merge. At the time, I was trying to use the
update option as a shortcut and that was not logical. The solution for
me was to go back to the using data and determine first the correct
single value for x1 per id group. I then dropped x1 in the master and
used the value from the using dataset.

Robert

On Tue, May 24, 2011 at 8:51 PM, laurendeason <[email protected]> wrote:
> Did you ever find out more about this? I have just encountered the same
> problem, but what is really strange is that the problem only occurs when I
> run my code on a version of Stata/MP 11.1 (on the linux cluster at my
> University), while when I run identical code on the version of Stata I have
> on my laptop (Stata/SE 11.1), it behaves differently (it behaves as one
> would expect merge 1:m, update to behave).  I also ran the code you posted
> on my version of Stata/SE 11.1, and indeed the merged records take the value
> of x1 from the using dataset for all observations.
>
> Does anyone know what's going on here?  Is there a problem with Stata/MP???
>
> --
> View this message in context: http://statalist.1588530.n2.nabble.com/Unexpected-results-with-merge-with-update-option-tp4899183p6401026.html
> Sent from the Statalist mailing list archive at Nabble.com.
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index