Statalist


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

st: re: text manipulation of tabulate output


From   Kit Baum <[email protected]>
To   [email protected]
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

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




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