Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Compare two files by record id variable if data sets have different record counts


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Compare two files by record id variable if data sets have different record counts
Date   Tue, 17 Apr 2012 22:20:11 +0100

Why not just -merge- and then compare what you get?

Note that the author of -cf3-, Thomas Steichen, is very firmly retired
from Stata activity.

Nick

On Tue, Apr 17, 2012 at 10:03 PM, Jeremy Page <[email protected]> wrote:

> I would like to compare record level data from two datasets that have
> different record counts using an id variable to link the two files.
>
> The user written command -cf3- (ssc install cf3) will compare two
> datasets and list the records that have conflicting information but
> the program will break after the command if the number of records in
> the two datasets is different. I have included an example below using
> auto.dta that shows the code breaking. I would like to be able to
> continue programming even if the number of records is different
> between the two files.
>
> Is there a command that will allow me to compare records across
> datasets using a record id that will not break if the sample sizes are
> different?
>
> I am using Stata 11.2 on Windows 7.
>
> Best,
> Jeremy
>
>
> *******Begin Example*********
> ssc install cf3
>
> webuse auto,clear
> gen id = _n
> drop if foreign == 1
> tempfile noforeign
> save `noforeign'
>
> webuse auto,clear
> gen id = _n
> cf3 _all using `noforeign', id(id) noverbose
>
> display "This line will not print."
> ******End Example*************

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index