I believe where a non-matching variable in the two
datasets have different values, the master dataset's
values supersede that of the using dataset. In your
case, I suspect KP was your master dataset.
Louis
--- Michael McCulloch <[email protected]> wrote:
> Dear Statalist members,
> I am merging two datasets, KP.dta and PS.dta, which
> were sorted by
> the variable <id>. They contain the subjects who
> from two different
> exposure groups.
>
> Values for <id> are unique to each dataset, so that
> <id> occurs only
> once in each dataset, and are not duplicated across
> datasets.
>
> Before the merge,
> In dataset KP, one variable <smoker> has values yes
> or no: 1/0.
> In dataset PS, <smoker> is missing.
> However, after the merge, PS now has values for
> <smoker>.
>
> I merged using this command:
> use "A.dta", clear
> merge using "B.dta"
>
> Then, checked my data:
>
> id group smoker
> 1 PS 1
> 2 PS 1
> 3 PS 1
> 4 PS 0
> 5 PS 0
> 6 PS 1
> 7 PS 1
> 8 PS 1
>
> What have I done wrong?
> Thank you kindly.
>
>
> --
>
> Michael McCulloch
> Pine Street Foundation
> 124 Pine St., San Anselmo, CA 94960-2674
> Tel: (415) 407-1357
> Fax: (415) 485-1065
> [email protected]
>
> *
> * For searches and help try:
> *
> http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
--------------------
Louis Boakye-Yiadom
34 Holloway
Bath
BA2 4PU
Phone (home): (44)-(0)1225-427699
Phone (mobile): (44)-(0)795 609 3780
___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/