Statalist The Stata Listserver


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

st: Re: First non-zero observation within a variable


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: First non-zero observation within a variable
Date   Sun, 04 Feb 2007 11:36:04 -0500

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

Michael Blasnik

----- Original Message ----- From: "Thomas Speidel" <[email protected]>
To: <[email protected]>
Sent: Sunday, February 04, 2007 12:38 AM
Subject: st: First non-zero observation within a variable



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 example:
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index