Bookmark and Share

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]

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


From   Richard Warr <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: how can I merge two data sets over a range of values
Date   Thu, 9 Feb 2012 10:01:45 -0500

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
15.9375
20.6
39.53
40.85
65.31
62.538
7.969
10.875
10.3
9.625
19.765
20.425
34.82
31.1
29.78
7.969
19.765


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 <[email protected]> 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.
>
> Lim
>
> On Wed, Feb 8, 2012 at 4:45 PM, Richard Warr <[email protected]> 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
>> variables).
>>
>> Any ideas?
>>
>> Thanks
>> Richard
>>
>> *
>> *   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/
>

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index