Statalist The Stata Listserver

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

Re: st: -graph bar, over-: problem with string vars and quotes

From   "Austin Nichols" <>
Subject   Re: st: -graph bar, over-: problem with string vars and quotes
Date   Fri, 9 Feb 2007 12:24:04 -0500

Friedrich Huebler--
I can envision a long round-about solution involving -tw bar- and
labeling the axis with locals defined inside a loop, but it would be
much simpler to replace each of your double quotes with two single
quotes.  Is that an acceptable solution?

On 2/9/07, Friedrich Huebler <> wrote:
I use Stata 8.2. My data contains long strings that sometimes begin
with quote marks. I use these string variables to define the groups
in -graph bar, over-. When the first word in a string is enclosed in
quote marks, the quotes disappear from the labels and the labels
themselves are broken up into more than one line. The effect can be
reproduced with the auto data.

sysuse auto, clear
sort make
gen n = _n
replace make = `""AMC Concord""' if make == "AMC Concord"
replace make = `""AMC" Pacer"' if make == "AMC Pacer"
replace make = `"AMC "Spirit""' if make == "AMC Spirit"
graph hbar mpg if n<5, over(make)

The AMC Pacer label should have quotes around "AMC". Instead, the
quotes are gone and the words AMC and Pacer are in two separate
lines. The labels for AMC Concord and AMC Spirit are drawn as
expected. Because of the nature of my data the labels should be
written in one line and with all quote marks. How can this be

Friedrich Huebler
*   For searches and help try:

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