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]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

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

Date |
Thu, 9 Feb 2012 16:16:36 +0000 |

Nick On 9 Feb 2012, at 15:01, Richard Warr <rswarr@gmail.com> 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 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 <lee.haklim@gmail.com> 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 youhave more than one value with price=20 your going to have to makethateach 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. LimOn Wed, Feb 8, 2012 at 4:45 PM, Richard Warr <rswarr@gmail.com>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. Currentlymy data sets each contain only a single stock price series (andothervariables).

* * 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/

**Follow-Ups**:**Re: st: how can I merge two data sets over a range of values***From:*Richard Warr <rswarr@gmail.com>

**References**:**st: how can I merge two data sets over a range of values***From:*Richard Warr <rswarr@gmail.com>

**Re: st: how can I merge two data sets over a range of values***From:*Lim Lee <lee.haklim@gmail.com>

**Re: st: how can I merge two data sets over a range of values***From:*Richard Warr <rswarr@gmail.com>

- Prev by Date:
**RE: st: Output logistic regression results using outreg** - Next by Date:
**Re: st: Zeros and measures of inequality or concentration** - Previous by thread:
**Re: st: how can I merge two data sets over a range of values** - Next by thread:
**Re: st: how can I merge two data sets over a range of values** - Index(es):