Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: artifacts after merge


From   Michael McCulloch <mm@pinest.org>
To   Statalist <statalist@hsphsun2.harvard.edu>
Subject   st: artifacts after merge
Date   Sat, 27 Oct 2007 21:48:56 -0700

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
mcculloch@pinestreetfoundation.org

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



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index