Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Re: Keeping the Earliest Observations on Each Leg


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: Keeping the Earliest Observations on Each Leg
Date   Tue, 13 Jun 2006 10:28:56 +0100

Note that you could easily keep the ties with
a small twist on this. 

bysort id lleg (date): keep if date == date[1] 

as under the aegis of -by:- subscripts are
understood to be calculated within-group.  

Nick 
n.j.cox@durham.ac.uk 

Michael Blasnik
 
> bysort id lleg (date): keep if _n==1
> 
> note: any ties on date will be rboken arbitrarily

Raphael Fraser
 
> >I  am interested in keeping the earliest observations on each leg
> > where  left leg is denoted (lleg=1) and right leg (lleg=0). 
> Can anyone
> > assist?
> > 
> >      id         date   lleg
> >       46   22aug1993      0
> >       46   28sep1993      1
> >       46   28sep1993      1
> <snip>> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index