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

st: RE: Compare two datasets


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Compare two datasets
Date   Fri, 7 Nov 2003 13:11:59 -0000

There are several possibilities. Here is one. 
I assume that dataset1 and dataset2 have _exactly_
the same set of variable names, say foo-bar: 

use dataset1 
gen set = 1 
append using dataset2 
replace set = 2 if mi(set) 
duplicates report foo-bar
duplicates tag foo-bar, gen(tag) 
edit if tag != 1 

Here the idea is that the operators did their 
job properly, each observation should appear
exactly twice, at least if each has an unique 
identifier. Any observation appearing just once 
or more than twice is then possibly in error. 

Nick 
n.j.cox@durham.ac.uk 

Xavi Barber
 
> I have two datasets, but is the same input by two operators.
> 
> I use the "cf" command, but I ' would know more 
> information, no only "15 
> mismatches" , it's possible?
 

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