Statalist The Stata Listserver


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

st: cutting panel data by date according to size


From   Yasmine Kent <yasmine_kent@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: cutting panel data by date according to size
Date   Sun, 28 May 2006 21:35:44 +0100 (BST)

Hello,

I have a panel data set of companies, with my time
variable "date" over many quarters, and my id variable
"co". I would like to categorise my data according to
size (my size variable is "TA"), into quintiles, BY
QUARTER. I want to get a single new variable, call it
quintile, that takes on values from 1-5 depending on
which quintile of size the company falls into in that
particular quarter. So for example a company might
have quintile=1 for a certain quarter in which it is
among the fifth of largest companies in that quarter,
and then quintile 2 for the next quarter if it is only
in the quintile of the second largest companies for
that quarter, and so on. So I would end up with an
equal number of companies in each of the 5 quintiles,
for each quarter. It is also important that I get a
single variable ("quintile") with values for every
company and every quarter (as opposed to separate
variables for each quarter).

I know this might sound complicated because of the
long-winded way I have explained it, but I think it
should be simple, I just don't know how to do it.
Doing it manually would be really horrible as I have
so many quarters. I thought that something like the
"cut" command under egen might do the trick. But the
problem is that "cut" cannot be used with the "by"
command., so it just gives 5 quintiles of equal size
over the whole sample, but not by quarter.

Any suggestions as to how to program this would be
much appreciated.

Thank you! :)
Yasmine




		
___________________________________________________________ 
Try the all-new Yahoo! Mail. "The New Version is radically easier to use"  The Wall Street Journal 
http://uk.docs.yahoo.com/nowyoucan.html
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index