Statalist The Stata Listserver


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

st: Re: percentages (p75)


From   "Jens Lauritsen" <[email protected]>
To   <[email protected]>
Subject   st: Re: percentages (p75)
Date   Mon, 30 Apr 2007 11:13:16 +0200 (CEST)

> I want me to create a "liberal" variable and a "conservative" variable
> by isolating the people who score in the top 25th percentile in a
> composite personal freedoms variable and the bottom 25th percentile

This is quite easy by using the result variables, following summarize.
Notice the option ", d": If you forget the percentiles will not be available

E.g. for a variable AGE:

summ AGE ,d

..... output cut out .....
75%           48             74
..... output cut out .....

* You can also see the result variables by:

return list

scalars:
..... output cut out .....
               r(p50) =  41
               r(p75) =  48
..... output cut out .....

* to create your indicators:
gen high = (AGE >= r(p75) )
gen low =  ( AGE < r(p25) )

list h AGE

      high  AGE
   1.    0   47
   2.    1   49
..... output cut out .....

regards

Jens Lauritsen
Southern Denmark University, Denmark
Coordinator and initiator of EpiData Project http://www.epidata.dk




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



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