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

st: re: text manipulation of tabulate output

From   Kit Baum <>
Subject   st: re: text manipulation of tabulate output
Date   Sat, 19 Apr 2008 10:27:04 -0400

Jacob said

This does not work if a categorical variable has a large number of categories; apparently there is a fairly small limit on how large a local macro can be.

WRONG! This is a common programming mistake (see Appendix B of my book). A statement like

local UNSORTEDLEVELS=r(levels)

is killing you because it has an equals sign, limiting the LHS to the possible length of a Stata string variable. The equivalent statement without the equals sign will allow the contents of macro r(levels) to be copied to UNSORTEDLEVELS up to the maximum length of a local macro, which is at least 165 Kbytes in all but Small Stata. In fact in Stata/SE and Stata/MP a local macro can contain over one million characters (-help limits-).


Kit Baum, Boston College Economics and DIW Berlin
An Introduction to Modern Econometrics Using Stata:

* For searches and help try:

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