Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Seeing if the last observation equals previous observations from a


From   "Clyde Schechter" <clyde.schechter@einstein.yu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Seeing if the last observation equals previous observations from a
Date   Sun, 25 Apr 2010 09:41:00 -0700

If all you need to know is whether any of the observations equals the
last, and you don't need to specifically identify them, then this will
also work (and it doesn't matter what type of variable X is):

capture assert X != X[_N] if _n < _N
local nothing_equal = (c(rc) == 0)

You can then use the nothing_equal local macro to condition subsequent code:

if `nothing_equal' {


Clyde Schechter, MA MD
Associate Professor of Family & Social Medicine

Please note new e-mail address: clyde.schechter@einstein.yu.edu

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index