| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: Re: -graph bar, over-: problem with string vars and quotes
From |
"Steichen, Thomas J." <[email protected]> |
To |
<[email protected]> |
Subject |
st: RE: Re: -graph bar, over-: problem with string vars and quotes |
Date |
Fri, 9 Feb 2007 12:18:19 -0500 |
The easiest solution is to use the single rather than double quote:
sysuse auto, clear
sort make
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<25, over(make)
-----------------------------------
Thomas J. Steichen
[email protected]
-----------------------------------
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Friedrich Huebler
Sent: Friday, February 09, 2007 12:13 PM
To: [email protected]
Subject: st: Re: -graph bar, over-: problem with string vars and quotes
A side effect of the broken label is that the position of adjacent labels is shifted. In the example below, with 24 bars, the label
for the AMC Concord has moved up and is no longer next to the bar.
sysuse auto, clear
sort make
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<25, over(make)
Friedrich
--- Friedrich Huebler <[email protected]> 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 accomplished?
>
> Friedrich Huebler
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/
*
* 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/
-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney-client or other legal privileges, and/or
proprietary non-public information. If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system. Use, dissemination, distribution,
or reproduction of this message and/or any of its attachments (if
any) by unintended recipients is not authorized and may be
unlawful.
*
* 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/