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: st: Merging only one variable into master dataset in Stata11


From   Neil Shephard <[email protected]>
To   [email protected]
Subject   Re: st: st: Merging only one variable into master dataset in Stata11
Date   Thu, 31 Mar 2011 08:03:30 +0100

On Thu, Mar 31, 2011 at 7:55 AM, Clifton Chow
<[email protected]> wrote:
> Dear List,
>
> Using Stata 11, does anyone know the syntax for merging only 1 variable from a large dataset (using) to another (master)?
>
> In the old syntax, it used to be something like below:
>
> merge id using H:\dataset\start_flat.dta, keep(salaryavg48)
>

Thats because you've got the wrong syntax for Stata 11, its changed
from previous versions.

Check the -man merge- and you'll see the option is now...

merge [1:1|1:m|m:1|m:m] id using H:\dataset\start_flat.dta,
keepusing(salaryavg48)

In the above [1:1|1:m|m:1|m:m] you should select one based on the type
of merge you are performing, whether its 1:1 (obs are unique in both
files) 1:m (obs unique in master but not in using), m:1 (obs unique in
using but not in master) or m:m (obs not unique in either file).

Neil

-- 
“Truth in science can be defined as the working hypothesis best suited
to open the way to the next better one.” - Konrad Lorenz

Email - [email protected]
Website - http://kimura.no-ip.org/
Photos - http://www.flickr.com/photos/slackline/

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