EconPapers    
Economics at your fingertips  
 

NEARMRG: Stata module to nearest match merging of two datasets on a numeric variable

Eric Booth

Statistical Software Components from Boston College Department of Economics

Abstract: nearmrg merges a using dataset onto the data in memory by NEAREST value of a numeric variable rather than by exact equality, which is what you want when the keys are dates, timestamps, or measurements that differ by rounding. For every master observation it finds the closest value of nearvar() in the using file, optionally within exact matches of a varlist, and optionally restricted to values at or below (lower) or at or above (upper) the master value. A limit() caps how far a match may reach; distance() records how far it did. Master and using variables may carry different names, and all standard merge options (keepusing, update, replace) pass through. Original package co-authored by Michael Blasnik and Katherine Smith (2003); taken over and rewritten by Eric A. Booth beginning in 2010.

Language: Stata
Requires: Stata version 11.0
Keywords: merge; data management; nearest neighbour; panel data (search for similar items in EconPapers)
Date: 2026-07-30
Note: This module should be installed from within Stata by typing "ssc install nearmrg". The module is made available under terms of the MIT license (https://opensource.org/licenses/MIT).
References: Add references at CitEc
Citations:

Downloads: (external link)
http://fmwww.bc.edu/repec/bocode/n/nearmrg.ado program code (text/plain)
http://fmwww.bc.edu/repec/bocode/n/nearmrg.sthlp help file (text/plain)

Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.

Export reference: BibTeX RIS (EndNote, ProCite, RefMan) HTML/Text

Persistent link: https://EconPapers.repec.org/RePEc:boc:bocode:s459834

Ordering information: This software item can be ordered from
http://repec.org/docs/ssc.php

Access Statistics for this software item

More software in Statistical Software Components from Boston College Department of Economics Boston College, 140 Commonwealth Avenue, Chestnut Hill MA 02467 USA. Contact information at EDIRC.
Bibliographic data for series maintained by Christopher F Baum ().

 
Page updated 2026-08-14
Handle: RePEc:boc:bocode:s459834