Statalist


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

st: String Match


From   "Susanna Khavul" <skhavul@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: String Match
Date   Fri, 13 Jun 2008 08:47:21 -0500

Quite often I have two files where subjects are identified by name.
The first file has ID codes and then the names, the second does not.
I need to assign the ID codes to the names in the second file.  Is
there a quick way of matching the two files and assigning the codes?
I have thousands of records.   Does stata match on strings through the
merge command.  I have not been able to do it.

For example

File 1:

ID_Code  Name
123         John Smith
124         Jane Smith

File 2:

Name

John Smith
Jane Smith
Sally Green

I would like File 2 to have:

ID_Code   Name
123          John Smith
124          Jane Smith
125         Sally Green

So here Sally Green is assigned a new ID_Code sequentially.
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index