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: Seeing if the last observation equals previous observations from a


From   "Clyde Schechter" <[email protected]>
To   [email protected]
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: [email protected]

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