Statalist The Stata Listserver


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

st: Re: question about merging two data sets with non-unique identifiers.


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: question about merging two data sets with non-unique identifiers.
Date   Sat, 07 Apr 2007 09:32:10 -0400

see -help joinby-

Michael Blasnik

----- Original Message ----- From: "Yan Zhang" <[email protected]>
To: <[email protected]>
Sent: Saturday, April 07, 2007 8:47 AM
Subject: st: question about merging two data sets with non-unique identifiers.



Hi, could anybody tell me how to solve the match
problem about merging two data sets both of which have
non-unique identifiers.

For example, if DataSet A has:
stock date
11 aa
11 bb
11 cc
33 AA

and dataset B has stock id
11 wen
11 fra


After using "merge stock using "......" ", I got the
following:
stock id date _merge
11 wen aa 3
11 fra bb 3
11 fra cc 3
33 AA 1

How could I get the results as follows as desired?
What I want is as follows:

stock id date _merge
11 wen aa 3
11 wen bb 3
11 wen cc 3
11 fra aa 3
11 fra bb 3
11 fra cc 3
33 AA 1

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