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

Re: st: percentile

From   Philip Ryan <>
Subject   Re: st: percentile
Date   Mon, 07 Feb 2005 13:57:19 +1030

centile var, cent(97)
drop if var > `r(c_1)' & var < .

Be careful, Stata will do exactly what you ask: this will drop any observations *on all variables* when for those observations var exceeds its 97th percentile.

You might prefer to tag those observations meeting/not meeting your criterion and use the indicator variable thereafter as a command qualifier:

centile var, cent(97)
gen byte useme = var <= `r(c_1)'

<<..subsequent stata comand>> if useme


At 08:06 PM 6/02/2005 -0600, you wrote:

i will appreciate if someone can help me.
how can i do if i want to drop all observations higher than some
percentile (for example higher than 97th percentile).
*   For searches and help try:
Philip Ryan
Associate Professor,
Department of Public Health
Associate Dean (Information Technology)
Faculty of Health Sciences
University of Adelaide 5005
South Australia
tel 61 8 8303 3570
fax 61 8 8223 4075
CRICOS Provider Number 00123M
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright. If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.

*   For searches and help try:

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