If it ain’t broke

August 20, 2009 at 6:55 pm

| Gabriel |

I was running some code today and noticed the return message

(note: you are using old merge syntax; see [R] merge for new syntax)

I looked this up and saw that the syntax had changed from this in Stata 10 and earlier:

use macro, clear
merge macro_id using micro

to this in Stata 11:

use macro, clear
merge 1:m macro_id using micro

My first thought was, aha, they must have added the “1:1” and “1:m” options as a way to make a more general syntax that will combine the functionality of merge, joinby, and cross into one command. However on RTFM I see that:

if you think you need to perform an m:m merge, then we suspect you are wrong. If you would like to match every observation in the master to every observation in the using with the same values of the key variable(s), then you should be using joinby

So it turns out that the what “m:m” does is not to replicate joinby, but to allow a sort order merge within matches, a prospect that the Stata people warn is probably a bad idea (and I agree).

So the new version of merge doesn’t add any real functionality and it seems to be changed only as a reliability check, so that you don’t accidentally do a one-to-many when you think you’re doing many-to-one. Since that worry has never kept me up at night in the first place, I’m sticking with the old syntax (which has not been deprecated and still works, even without the “version” command).

(That aside I’ve been very happy with Stata 11 so far. It’s running really fast and most of the changes are clear improvements).

Entry filed under: Uncategorized. Tags: , .

SPPA 2008 TextWrangler 3


The Culture Geeks


%d bloggers like this: