Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Merge Problem


From   Jason Hwang <[email protected]>
To   [email protected]
Subject   st: Merge Problem
Date   Wed, 3 Aug 2005 23:53:20 -0400 (EDT)

Hi,

Would someone kindly help me with this problem?

I'm trying to join two datasets. The matching is one to many. Let's call
identifiers in the two datasets id1 and id2.  I have a concordance of the
form (all variables are string):

id1	id2
111	4569
111	4574
112	51--
112	5689
113	411-
113	4145
113 	4310

The problem is where I have an entry for id2 like 51--. This means all
four digits that start with 51 should be matched to the id1 value of 112.
Likewise, 411- means all four digits starting with 411 correspond to 113.

If I had just one entry like that, then I could go into dataset2 and
create another id variable for which all id2s starting with 51 or 411 have
the same value, and come back and make the appropriate change in the
concordance. But I have many cases like this where many id2s match with
id1. Would there be an easy way to take care of this? Perhaps some way to
automate the creation of an alternative id2 in the second dataset?

Thank you very much for your help.

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