Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: merge with condition or vlookup with not-exact-match
From
"Sarah Kristina Reuter" <[email protected]>
To
[email protected]
Subject
st: merge with condition or vlookup with not-exact-match
Date
Thu, 09 Sep 2010 14:07:17 +0200
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/