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]
st: looping over observations in a single variable
From
"Casey P. Durand" <[email protected]>
To
[email protected]
Subject
st: looping over observations in a single variable
Date
Mon, 12 Jul 2010 12:36:22 -0500
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/