Statalist


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

st: merge: "variable does not uniquely identify observations in the masterdata"


From   Jeff Pflueger <jeff@infouse.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: merge: "variable does not uniquely identify observations in the masterdata"
Date   Tue, 08 Jul 2008 16:46:41 -0700

I am having problems with merge. I am running Stata 10.0 on a Mac (powerPC)

I am merging a dataset of variables pertaining to individuals within households to a dataset of variables pertaining to the households that they are within. The Households are identified by a unique key in the household dataset. In the people dataset, the household key exists, but is clearly not unique.


If I do this, I get the error I would expect:

use "$people", clear
merge householdno using "$household", uniqmaster sort

the error is in red on the command line and it terminates my do-file.
It says: "variable householdno does not uniquely identify observations in the master data"

Makes sense, the master dataset does not contain unique householdno's but the household dataset does.

But if I do this:

use "$people", clear
merge householdno using "$household", uniqusing sort

I get the same error: "variable householdno does not uniquely identify observations in the master data" but in this case, the do-file continues to run, and the error message is in green, not red.

But householdno is unique in the master dataset....

When I:
use "$household", clear
duplicates list householdno

I get this:

Duplicates in terms of householdno

(0 observations are duplicates)

Any ideas about what I am doing wrong here? The error message is certainly disconcerting.


Thanks,
Jeff


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