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

Re: st: How to merge 2 datasets using 2 unique variables


From   Ulrich Kohler <kohler@wz-berlin.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to merge 2 datasets using 2 unique variables
Date   Tue, 26 Apr 2005 17:00:14 +0200

Robin Newberry wrote:
> >  I recommend to use strings.
>
> Hmmmm. OK then - how do I put the hyphens into the non-hyphenated string?

No, no. Don't put hyphens into the numbers. Just tread the numbers as strings. 
In your non-hyphenated dataset type something like

. ren ssn ssnreal
. destring ssnreal, generate(ssn)
. sort ssn
. save foo, replace

and than merge. 

The reason for my recommendation, btw is, that numbers with many digits like 
the SSN, can get obscured by the storage-type "float". I generally use 
string-variables for unique-identifiers therefore ...

uli


-- 
kohler@wz-berlin.de
+49 (030) 25491-361


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