Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: cutpoints for deciles


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: cutpoints for deciles
Date   Tue, 10 Jul 2012 14:14:55 +0200

On Tue, Jul 10, 2012 at 1:44 PM, "Fabian Schönenberger" wrote:
> My goal is to assign each company to a decile according to its market capitalization on a yearly basis. Instead of forming equally distributed portfolios with xtile2 (Stata module by Wang), I want the assignment based on 10 cutpoints of the market capitalization.
>
> For example: If in year 1 the smallest company is 200, the largest 2000, there are the following cutpoints: 200,380,560,740,920,1100,1280,1460,1640,1820,2000. A company with market capitalization of 250 should be in portfolio 1, one with 1900 market capitalization in portfolio 10.

First of all, I would not call these deciles, you might call them bins.

Here is one solution:

*-------------- begin example --------------
clear
input x
200
250
1900
2000
end

sum x, meanonly
gen x_cat = (x - r(min)) / (r(max)-r(min))
replace x_cat = ceil( 10 * x_cat)
list
*--------------- end example ---------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

Also see: Nicholas J. Cox (2003) Stata tip 2: Building with floors and
ceilings. The Stata Journal, 3(4): 446-447.
<http://www.stata-journal.com/article.html?article=dm0002>

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index