Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: cutpoints for deciles

From   Maarten Buis <>
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 --------------
input x

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

Also see: Nicholas J. Cox (2003) Stata tip 2: Building with floors and
ceilings. The Stata Journal, 3(4): 446-447.

Hope this helps,

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

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index