[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Re: Question about merging two datasets
At 00:03 1-9-2003, email@example.com wrote:
What if I have other variables besides city and income in dataset A and
Please take a look at the magnificent mmerge.ado by Jeroen Weesie, it
should handle your problem quite easily (type -ssc inst mmerge- ).
B (and they are different variables in each dataset) but I only want to merge
in the matching incomes from dataset B to replace the incorrect ones in
A (i.e. I want to leave alone the rest of the variables in dataset A)?
Quoting Michael Blasnik <firstname.lastname@example.org>:
> This appears to be a most basic merge.
> assuming that dataset A is already sorted by city, then:
> use B
> sort city
> merge city using A
> These commands will result in a combined dataset where the value of income
> from B takes precedence.
The trick is to specify that values of the master dataset A should be
overwritten if there is disagreement with corresponding values in using
dataset B. That is:
mmerge city using B, ukeep(income) replace update
SEO Amsterdam Economics
University of Amsterdam
1018 WB Amsterdam
tel.:+ 31 20 525 1657
fax:+ 31 20 525 1686
A statistician: someone who insists
on being certain about uncertainty
* For searches and help try: