Statalist


[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 of range?


From   bumbuminc <[email protected]>
To   [email protected]
Subject   Re: st: How to drop some Observation in Stata, if they are out of range?
Date   Tue, 23 Sep 2008 12:03:13 +0200

Sorry for the trouble i have caused.
Problem solved

i have two solutions for my problem:

***********************************
_pctile earnings, p(2.5 97.5)
 drop if earnings <r(r1) | earnings >r(r2)
*************************************

and

*******************************************
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')
*************************************************

Thank you for the help (Maarten, Neil and Martin)

2008/9/23, Martin Weiss <[email protected]>:
> You are welcome :-) Seems bumbuminc contacted the three of us (Maarten, Neil
> and me) off the list which is very bad practice as it promotes duplication
> of effort and prevents the rest of world from enjoying our collective wisdom
> :-)
>
>
> HTH
> Martin
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Neil Shephard
> Sent: Tuesday, September 23, 2008 11:21 AM
> To: [email protected]
> Subject: Re: st: How to drop some Observation in Stata, if they are out of
> range?
>
> Martin Weiss wrote:
>> In a similar vein, but shorter:
>> ***********
>> _pctile earnings, p(2.5 97.5)
>> drop if earnings <r(r1) | earnings >r(r2)
>> ***********
>>
> Certainly useful to me, cheers for the pointer on -_pctile-
>
> Neil
>
> ***********************************************************************
> 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
> to: www.connectingforhealth.nhs.uk/nhsmail
> ***********************************************************************
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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