# RE: st: RE: Percentiles: Identify of smallest observation closet to percentile value

 From "Ronnie Babigumira" To Subject RE: st: RE: Percentiles: Identify of smallest observation closet to percentile value Date Mon, 3 Feb 2003 12:13:38 +0100

```Hi
There is a possibility that I have missed your point, however, when u say
you want stata to tell you what observation is at75th percentile here is
what comes to mind. Say you wanna do it for your variable "var"

sum var, d              /*This will give you the percentiles*/
local p75 = r(p75)      /*Put the value of var at the 75th percentile in a
local macro*/

list obs var if var == `p75'

I would be interested in knowing how to get a new macro _n-1 where _n is the
observation (or id) number for 75th percentile value

Ronnie

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Rod Hunter
Sent: 3. februar 2003 11:42
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: RE: Percentiles: Identify of smallest observation
closet to percentile value

Thanks for responding Nick.

A simple eg. will suffice.

Obs. Var1
----------
1     	10
2	9
3	8
4	7
-----------

I would like Stata to tell me the value of the observation that is at or
below the 75th percentile point, and to yield the identity (or
identities) of the observation(s).

Rod Hunter

Nick Cox wrote:
> Rod Hunter
>
>
>>I would be grateful if a StataList member could tell me how I can
>>efficiently indentify the observation that is the smallest
>>observation
>>closest to a percentile value? Similarly, how can I generate a new
>>variable that is the smallest observation closest to the percentile?
>
>
> of ties. But even when there is a unique answer, do you want
> to put a single value into a variable?
>
> It might help if you were to use a commonly accessible data
> set -- e.g. the auto data -- to give examples of what you
> want to do.
>
> Nick
> n.j.cox@durham.ac.uk
>
> *
> *   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/
>
>
>

*
*   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/

*
*   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/
```