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

Re: st: How to drop some Observation in Stata, if they are out ofrange?

From   Neil Shephard <[email protected]>
To   [email protected]
Subject   Re: st: How to drop some Observation in Stata, if they are out ofrange?
Date   Tue, 23 Sep 2008 10:14:00 +0100

bumbuminc wrote:
Thanks for your answer,
but the problem is i don't now the min and max values. I want to drop
the observations if they are under 2.5% and over 97.5% of the maximum
This would have been useful to state in your original question!

Its not that hard though...

sysuse auto, clear
centile price, centile(2.5)
local min = r(c_1)
centile price, centile(97.5)
local max = r(c_1)
gen restrictedprice = price if(price > `min' & price < `max')

Its general etiquette on Statalist to reply to the list rather than individuals as it means that the archives then contain complete solutions to problems which are then searchable by others.


This message may contain confidential and privileged information.
If you are not the intended recipient you should not disclose, copy
or distribute information in this e-mail or take any action in reliance
on its contents. To do so is strictly prohibited and may be unlawful.
Please inform the sender that this message has gone astray before
deleting it. Thank you.

2008 marks the 60th anniversary of the NHS. It's an opportunity to pay
tribute to the NHS staff and volunteers who help shape the service, and
celebrate their achievements.

If you work for the NHS and would like an NHSmail email account, go

* For searches and help try:

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