Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: merge


From   David Kantor <dkantor@jhu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: merge
Date   Fri, 20 Feb 2004 10:27:43 -0500

Perhaps they are not mean to be unique. You need to consider the nature of your data to determine that.

But meanwhile, a good rule to follow is that in general, for a matched -merge- to be meaningful, either the master or the using should be unique in the identifier(s) -- perhaps both, but at least one of them should be unique. In your case, the using data are not unique, but presumably, the master data are. This may be quite okay; that depends on the nature of the data.

Assuming that it is meaningful to merge your datasets with these conditions, you should specify
-uniqmaster-, rather than -unique-.

(When one dataset is unique and the other isn't, I find it conceptually easier to comprehend if it is the master data that are unique. But it really doesn't matter.)

On the other hand, if you truly need for both sets to be unique, then there is something wrong with the data.

I hope this helps.
-- David

At 06:43 AM 2/20/2004 -0800, Anuja wrote:

Dear Stata users,

I am trying to merge two datasets with 5 unique
identifyers. The master dataset has 1396 obs, and the
using one has 8675.

 merge  prov cd cu dwg month using
"C:\PNG96\Data\hh-merged.dta"
1) when i use the option unique i get
variables prov cd cu dwg month do not uniquely
identify observations in the using data

I have sorted them, and cann't figure out what how to
go abt it.

Thanks,
Anuja
[...]
David Kantor
Institute for Policy Studies
Johns Hopkins University
dkantor@jhu.edu
410-516-5404

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