I too just have to chime in on this one since I haven't seen
anyone mention an FAQ with full discussion of almost the
same problem.
How can I drop spells of missing values at the beginning and end
of panel data?
http://www.stata.com/support/faqs/data/dropmiss.html
A tweaking of an example there gives another one line solution
similar in spirit to Michael's:
by group (time), sort: drop if _n == sum(mi(response) | response == 0)
Nick
n.j.cox@durham.ac.uk
Michael Blasnik
> I just have to chime in on this one since I haven't seen
> anyone mention a
> simple one line solution:
>
> bysort group (time): drop if sum(expression!=0 & expression<.)==0
Thomas Speidel
> >I am trying to tag the first non-zero, non-missing
> observation within a
> > variable by group. The goal is to drop anything BEFORE the
> expression
> > is measured within a group.
*
* 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/