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

Re: st: About mismatches in merge


From   Ernest Berkhout <ernestb@seo.fee.uva.nl>
To   statalist@hsphsun2.harvard.edu, <statalist@hsphsun2.harvard.edu>
Subject   Re: st: About mismatches in merge
Date   Wed, 31 Mar 2004 11:55:19 +0200

At 00:07 31/03/2004, Ivar Pettersen wrote:
I have been merging some files lately and discovered that _merge_
fails to match observations when the key-variables have different
precision.

If the key variable is measured as long in one file and float in the
other, most of my valid matches fail. _merge_ does tell me that the
key variable has been recast to a double, but I do feel that _merge_
should warn the user of potential false mismatches due to different
precision. If I make sure the key is stored as long in both files the
matches are correct.

I should mention that the key-variable I am using is a 9-digit
integer. I feel that this behaviour may be linked to the scale of the
key-variable.

Am I missing something here?
This is an often made mistake, and the answer lies in the last paragraph's mentioning of a 9-digit variable. Precision in the standard float-datatype is limited to 8 digits, therefor when one creates identifying variables such as respondent numbers, always be sure to create these in the long-datatype (see -help datatype- for more info) or maybe even as string variables.


Ernest Berkhout
SEO Amsterdam Economics
University of Amsterdam

Room 3.08
Roetersstraat 29
1018 WB Amsterdam
The Netherlands

tel.:+ 31 20 525 1657
fax:+ 31 20 525 1686
http://www.seo.nl
===========================
A statistician: someone who insists
on being certain about uncertainty
===========================

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