Thank you Ulrich! This works perfect.
2009/11/10 Ulrich Kohler <[email protected]>:
> There is a egen function in -egenmore- for this:
>
> . ssc install egenmore
> . egen mcadecile = xtile(mcap), by(years) p(10(10)90)
>
>
> Am Dienstag, den 10.11.2009, 10:43 +0100 schrieb Kaspar Dardas:
>> Hello,
>>
>>
>> I have two variables years (2005 2006 2007...) and mcap (which is the
>> capitalization of firms, numeric values). I would like to create
>> deciles of mcap by years (not across the entire sample but for each
>> year) . Is there a quick way to do this besides a loop for the below?
>>
>> xtile mcapdecile = mcap, nq(10)
>>
>> Many thanks,
>>
>> Kaspar
>>
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/statalist/faq
>> * http://www.ats.ucla.edu/stat/stata/
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/