Statalist The Stata Listserver


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

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


From   Friedrich Huebler <[email protected]>
To   [email protected]
Subject   st: Re: -graph bar, over-: problem with string vars and quotes
Date   Fri, 9 Feb 2007 10:35:45 -0800 (PST)

Many thanks for the suggested solutions for my problem with broken
labels. The -twoway bar- approach is interesting because the
underlying data doesn't have to be modified. Nick's code also doesn't
appear to suffer from an additional problem that I encountered.

Substituting single quotes for all double quotes requires only one
additional line of code. However, the labels are cut off almost
completely (at least in Stata 8.2) if the graph has fewer than 20
bars, as you can see by running the following commands.

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"
replace make = subinstr(make,`"""',"''",.)
graph hbar mpg if _n<20, over(make)
more
graph hbar mpg if _n<21, over(make)

Friedrich



 
____________________________________________________________________________________
Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091
*
*   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