Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: merge with condition or vlookup with not-exact-match


From   Eric Booth <ebooth@ppri.tamu.edu>
To   "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: merge with condition or vlookup with not-exact-match
Date   Thu, 9 Sep 2010 13:23:56 +0000

<>

You might try -nearmrg- from SSC for your problem.  
See this thread for an example:

http://statalist.1588530.n2.nabble.com/st-Working-with-large-data-set-like-a-database-td4239888.html

~ Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754



On Sep 9, 2010, at 7:07 AM, Sarah Kristina Reuter wrote:

> Hi everyone,
> 
> I do not know if the following is possible in Stata, I hope anyone has an idea 
> how to address it:
> 
> I want to merge 2 files, but the "ID"-variable is not unique in the sense that in 
> the master file it is a point in time and in the using file it is a period of time 
> defined as start-point of time and end-point of time. To illustrate the 
> problem, let me give an example:
> 
> Master				Using
> Point of Time	- V1		Starttime     - 	Endtime     - 	V2
> 
> What I need is: 
> Point of Time - V1 - V2  if Point of Time >= Starttime & Point of Time <= 
> Endtime
> 
> Something like 
> merge Point of Time/master using Using if point of time in period of time, 
> update
> should do, just that I don't know how to build this command.
> 
> To me, it seems similar to the Excel-Function vlookup with not-exakt-match 
> (the default-value of this function), which, if an exact match is not found,  
> looks for the next largest value that is less than the key value. I've already 
> tried the vlookup.ado but it seems to be an exact-match only.
> 
> Any ideas? Really looking forward to any recommendations!
> Best regard
> Sarah
> 
> 
> 
> -- 
> Dipl.-Kffr. Sarah Reuter
> 
> Friedrich-Schiller-Universität Jena
> Wirtschaftswissenschaftliche Fakultät
> Lehrstuhl für Allgemeine Betriebswirtschaftslehre,
> insbesondere Finanzierung, Banken und Risikomanagement
> Carl-Zeiss-Str. 3
> 07743 Jena
> Tel.: +49 (0)3641 9 43123
> Fax: +49 (0)3641 9 43122
> 
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/




*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index