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: looping over observations in a single variable


From   Abhimanyu Arora <[email protected]>
To   [email protected]
Subject   Re: st: looping over observations in a single variable
Date   Mon, 12 Jul 2010 19:48:28 +0200

One strategy could be to use -duplicates drop-  and making use of
[_n+1] or [_n-1] in the -if- option.

On Mon, Jul 12, 2010 at 7:36 PM, Casey P. Durand <[email protected]> wrote:
> Hi folks,
>
> I'm trying to figure out how to loop over sets of observations within
> a single variable.  Basically, I've got a variable which contains
> dates.  There are about 15 observations with one date, then another 15
> with the next days date, and so on, for a total of about 7 days.  Each
> individual observation also contains two other variables with GPS
> coordinates in them.   However, in some cases, some dates were copied
> and pasted in between other dates, creating some interruptions in the
> data.  I'm attempting to find a way to ID those inserted segments.  To
> visually describe this, a generic example would be something like
> this:
>
> Var1
> ------
> Z1
> Z1
> Z2
> Z2
> Z3
> Z3
> Z1
> Z1
> Z4
> Z4
>
> In this example, the parts I want to flag and, if possible, delete,
> are the Z1s between the Z3s and Z4s.
>
> I'm having a tough time doing this for observations within a single
> variable.  Does anyone know how to do this in Stata?
>
> Thanks in advance,
>
> Casey
> *
> *   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/
>

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