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: merge: what is the difference between assert(results) and keep(results)?


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: merge: what is the difference between assert(results) and keep(results)?
Date   Wed, 2 Mar 2011 14:21:45 +0000 (GMT)

--- On Wed, 2/3/11, emanuele mazzini wrote:
> I am starting to use Stata right now and I cannot really
> understand the difference between assert(results) and keep
> (results).  The Stata help is not a big aid in this sense.

When you merge two files a couple of things can happen: a 
match exist, a observation can be in the master file but not
in the user or vice versa. After -merge- there will a variable,
called _merge, that will contain a code for each observation 
(=row) that tells you which of these scenarios applies for that 
observation. With the -assert()- option you ask Stata to stop
whatever it is doing when one or more observations fall into
a scenario you did not specify. If that happens -merge- will 
also give you an error message. With the -keep()- option you
ask -merge- to only keep those observations that fall within
the scenarios you specified. It will not issue an error message
and if this is part of a .do file than the .do-file will 
continue running.

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------


      

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