Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: panel data management - dividing into quartiles


From   David Jacobs <[email protected]>
To   [email protected]
Subject   Re: st: panel data management - dividing into quartiles
Date   Sun, 15 May 2005 17:17:10 -0400

The command xtile listed in the manual under pctile will give you the quartiles or quintiles you need. Then a clunky way to find the highest value in a quartile is to use the list command with if conditions after sorting the values of the variable of interest. Finally, construct a dummy in the usual way with a generate command modified by if statements.

I'll bet the experts can come up with a more economical way, but this should work.

Dave Jacobs

At 01:10 PM 5/15/2005 -0700, you wrote:

Hi,

I have a panel data set, with data on a number of
companies over a number of years. Each observation is
a particular company and year, and has various data
for that observation.

I would like to divide my data into 4 quartiles or 5
quintiles, on the basis of one of my variables,
assets. So I would like to create a variable, call it
quartile, that has the value 1 if that observation is
in the top quartile of assets for that year, has the
value 2 if that observation is in the second quartile
of assets for that year, etc. (So of course a company
might have different values of "quartile" in different
years, depending on which quartile of assets it fits
into in a particular year. The quartiles will probably
contain somewhat different companies in each year.)
The reason that I want to do this is that I can run
regressions separately for each quartile.

I was thinking that I would need to use the by var:
command, as in "by assets: ", but I'm not sure how to
do it, although it seems like it should be simple.

Thanks in advance for any help!

Crystal



__________________________________
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.
http://mobile.yahoo.com/learn/mail
*
*   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/



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