help with interquartile ranges

help with interquartile ranges

by Ralph Wang -
Number of replies: 3

Hello:

I have a continuous variable that I would like to convert to interquartile ranges. Is there a specific way to do it? Or do I use summarize to find the IQR values and generate/label/recode?

Ralph

 

 

In reply to Ralph Wang

Re: help with interquartile ranges

by Eric Seeley -

Hi Ralph - Check out this website. 

http://stackoverflow.com/questions/13029266/how-to-split-a-sample-according-to-a-certain-variable-in-stata

In reply to Ralph Wang

Re: help with interquartile ranges

by Sofia Verstraete -

Ralph,

There is an egen command that allows you to create quartiles (four groups containing 25% of the population in each)- the interquartile range is the range between the 25th percentile and the 75th percentile...

egen newvar = cut(var), group(4)

This egen command will categorize your variable into four groups (values of 0-3). For more information on this you can enter help egen in stata and it will take you to the help window. You can use this same command to create tertiles or quintiles or any other grouping, just specify the number of groups you want to create after the "group" option.

Hope this helps!
Sofia




In reply to Sofia Verstraete

Re: help with interquartile ranges

by Ralph Wang -

THanks everyone - it totally worked!

Ralph