Statalist The Stata Listserver


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

Re: st: Unbalanced parentheses in command when I'm not using any parentheses


From   [email protected] (Vince Wiggins, StataCorp)
To   [email protected]
Subject   Re: st: Unbalanced parentheses in command when I'm not using any parentheses
Date   Wed, 06 Dec 2006 23:24:53 -0600

Joe McCrary <[email protected]> writes,

> . histogram mc2t0405
> (bin=20, start=44.09, width=2.7955)
> parentheses unbalanced
> r(132);

And Nick Cox <[email protected]> diagnosis the problem as stemming from the
variable mc2t0405 have a label with unbalanced parentheses, such as 
"not (balanced".  

Nick also correctly surmises that the problem arises from parsing.

This parsing is more subtle than normal, because unlike most Stata commands,
the axis titles for graphics commands can come either from a variable label or
from an option on the command.  When typed, users expect that they can quote
strings with unbalanced parentheses or other oddities and get exactly what
they expect.  When reading from labels, such things typically are not quoted.
(Joe, don't try quoting your label, it won't help).

The bottom line is that you can't use a common parser for axis titling options
and for reading from the label, and that is what graphics currently tries to
do.  Coincidentally, we were aware that labels could print "oddly", and have
been working on splitting this parsing along two tracks.  We were not aware
that an ugly error like Joe shows us was possible, so this will get more
immediate attention.

Splitting sounds simple, but because so many different types of parsing run
through common programs it is a bit tricky.  I tried Nick's example using the
split-track parsing, but it is not yet up to handling this without breaking
other graphs in our certification suite.  I am hopeful that this can be
released in the next ado update.

It isn't pretty, but until then, the only thing Joe can do is either get that
label off of his variable, or balance it's parentheses.  Or better, clone
the variable as Nick showed so the original variable is not affected.  Then,
if Joe still wants an unbalanced parenthesis in his axis title he can add an
option to get it,

    . histogram ... , xtitle("not (balanced")

 
-- Vince
   [email protected]

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