Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: How to drop the entire case from the panel?

From   John Hennen <>
Subject   st: How to drop the entire case from the panel?
Date   Fri, 11 Jul 2003 18:50:26 -0400

Olena Stavrunova wrote:

> I have a panel data (id and quarters). Could you, please, let me know how to
> delete the entire case, that is all observations for the individual if, for
> example, in at least one quarter variable v1 takes a negative value for this
> individual.

tempvar x y
gen `x' = v1<0
egen `y' = max(`x'),by(id)
drop id if `y' ==1

john hennen

Any information, including protected health information (PHI), transmitted in this email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential and or exempt from disclosure under applicable Federal or State law. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon, protected health information (PHI) by persons or entities other than the intended recipient is prohibited. If you received this email in error, please contact the sender and delete the material from any computer.

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index