Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Strange merge behavior


From   Danielle H Ferry <[email protected]>
To   StataList <[email protected]>
Subject   st: Strange merge behavior
Date   Fri, 3 Mar 2006 19:01:09 -0500

Dear Statalisters,

I wonder if anyone can explain to me the bizarre behavior I am getting on a match merge. The master dataset is a panel (12 years), and the data is not unique on the match variable (placefip). The using dataset contains just 2 variables: the match variable (placefip) and another (macci), which is what I am after here. The using dataset is unique on the match variable (placefip). There is a 1-1 correspondence btween placefip and macci in the using dataset. When I merge on placefip, however, I get the result that macci differs by year within placefip. For example:

. ta year macci if placefip==5553000, mi

| Center city
year | 1 . | Total
-----------+----------------------+----------
1990 | 12,818 0 | 12,818
1991 | 12,607 0 | 12,607
1992 | 12,437 0 | 12,437
1993 | 12,187 0 | 12,187
1994 | 11,749 0 | 11,749
1995 | 11,183 0 | 11,183
1996 | 11,237 0 | 11,237
1997 | 0 10,741 | 10,741
1998 | 0 11,002 | 11,002
1999 | 0 11,254 | 11,254
2000 | 0 11,150 | 11,150
2001 | 0 11,196 | 11,196
-----------+----------------------+----------
Total | 84,218 55,343 | 139,561

I don't see how this can be! (Please note that for placefip==5553000, _merge==3 in all cases.) After the merge, macci should be constant within placefip (and _merge==3), right? Perhaps I have been working at this too long, and the answer is obvious. If so, I apologize. Can anyone please help?

Thanks,
Danielle H Ferry


*
* 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/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index