Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Tolerance for -merge- variable

From   Rob Ploutz-Snyder <[email protected]>
To   [email protected]
Subject   st: Tolerance for -merge- variable
Date   Wed, 28 Mar 2012 13:26:05 -0500

I notice that when I have an ID variable stored with 1 decimal place
(ex. id=id+0.1) in two separate data files, the merge command
sometimes fails to equate ID values that are equal within rounding
error.  This is particularly problematic if Stata generated one of
these id variables (ex. gen idnew=id+0.1) and Excel or some other
software generated the id variable in the other dataset (including
hand data entry).

Is there a way to adjust the tolerance that -merge- uses on the ID var
that is in both data sets so that it links properly out to (for
example) 1 or 2 or 3 digits past the decimal??

My only solution so far is to generate a string variable from the
numeric ID variables in each dataset and then use the string variable
for the -merge- but it seems like there should be a simpler way to
tweak the tolerance within -merge-.  My other solution is to try to
avoid circumstances when the unique ID is a non-integer, but that's
not always an option for me.

Many thanks,
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index