Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



--------------------------------------------------------------------------------

I rarely use the update option with the merge command and this time I
got an unexpected result. Below is an example of a 1 to many merge
with the variable x1 being missing in the master. I was expecting that
merged records would take the value of x1 from the using dataset but
that is not the case for id == 2. Does anyone understand what is
happening?

Robert

*--------------------------- begin example -----------------------
version 11

clear
input id x1 seq
1 .  1
1 22 2
1 33 3
1 44 4
2 11 1
2 .  2
2 33 3
2 44 4
end

tempfile u
save "`u'"

clear
input id x1
1 .
2 .
end

merge 1:m id using "`u'", update

sort id seq
list , noobs sepby(id)
*--------------------- end example --------------------------

On Wed, May 25, 2011 at 1:51 AM, laurendeason <laurendeason@gmail.com> 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index