Statalist The Stata Listserver


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

st: Create dummy variable in panel


From   Christian Andres <[email protected]>
To   [email protected]
Subject   st: Create dummy variable in panel
Date   Fri, 02 Feb 2007 21:05:56 -0500

Hi,

I have a problem generating a dummy variable in a panel dataset.

My dataset contains 300 companies over 10 years. For each company, I have a size measure, total assets (ta). What I want to do now, is to generate a dummy variable which is 1 if the company's size is larger than the sample median in each year. This means that I need ONE variable, say "large" which first lists this measure for ten years for company 1, then 10 years for company 2...

To make things easier to understand:
In year 1996 the median is 50, in 1997 60, in 1998 55:

company year ta DUMMY_LARGE
1 1996 51 1
1 1997 53 0
1 1998 56 1
1....

I tried some gen and egen commands using by:year, but I did not come up with a solution.

Thank you very much for any suggestion!
Christian
*
* 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