Statalist The Stata Listserver


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

st: RE: Strange merge behavior


From   "Thuy Le" <[email protected]>
To   <[email protected]>
Subject   st: RE: Strange merge behavior
Date   Fri, 03 Mar 2006 22:15:06 -0500

First, did you check to see if both datasets are uniquely identified by the
time and id variable? 
Second, did you sort the data set?
Thuy
 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Danielle H Ferry
Sent: Friday, March 03, 2006 7:01 PM
To: StataList
Subject: st: Strange merge behavior

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/


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