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]

Re: st: how can I merge two data sets over a range of values

From   Nick Cox <>
To   "" <>
Subject   Re: st: how can I merge two data sets over a range of values
Date   Thu, 9 Feb 2012 16:16:36 +0000

Can you explain why this is not an -append- problem, that is, precisely why you want matching or pairing and in what sense you expect 1:1 matching or pairing to be possible anyway?


On 9 Feb 2012, at 15:01, Richard Warr <> wrote:

Thanks, but I am not sure that will work as my variables are
continuous.  Both the dataset1 variable and the dataset2 variables can
vary up to 3 decimal places.  In each case I want to merge them if
they are basically close to each other even if they aren't exactly
alike.   So something like merge x with y(+/- 0.5) is what I am
looking for.

Here is just a snippet of the data

In each case I want to be able to set a level of precision for the
merge and allow a merge even if the variable isn't exactly the same.
Perhaps it can't be done!

On Wednesday, February 8, 2012, Lim Lee <> wrote:
you can create a variable "x" tagging all price==20 in dataset1 and
variable "x" tagging all price in the range of 19.5 to 20.5.  If you
have more than one value with price=20 your going to have to make that
each observation unique or drop one since merging m:m makes little
sense and the merging process requires at least one dataset to be
uniquely identified with regard to the variable your are matching the
datasets with.

hope this might be of help.


On Wed, Feb 8, 2012 at 4:45 PM, Richard Warr <> wrote:
Hi, I want to merge two data sets.  The merge variable is the stock
price.  However I would like to merge over a range of prices.  For
example if the price is 20 in dataset1, I would like that to merge
with any price in the range of 19.5 to 20.5 in dataset2.   Currently
my data sets each contain only a single stock price series (and other

*   For searches and help try:

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