Home  >>  Archives  >>  Volume 18 Number 3  >>  dm0095

The Stata Journal
Volume 18 Number 3: pp. 741-754

Subscribe to the Stata Journal

Speaking Stata: From rounding to binning

Nicholas J. Cox
Department of Geography
Durham University
Durham, UK
Abstract.  This is a basic review of how to bin variables in Stata, meaning how to divide their range or support into disjoint intervals. I survey rounding functions with emphasis on floor and ceiling functions as tools to get clearly defined intervals of equal width. Using a specific display format is usually a better idea than rounding to multiples of a fraction. Quantile binning is popular in several fields. I give tips and tricks on how to produce such bins and also on how to show their limitations. Experimentation with the display command or Mata is a good way to learn about functions and to test binning rules.
Buy article (PDF): $14.00 View cart
Buy entire issue (PDF): $28.00

View all articles by this author: Nicholas J. Cox

View all articles with these keywords: binning, rounding, format, display, quantiles

Download citation: BibTeX  RIS

Download citation and abstract: BibTeX  RIS