Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Locals with two word phrases and graph titles
From
Sergiy Radyakin <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Locals with two word phrases and graph titles
Date
Tue, 13 Aug 2013 18:34:25 -0400
On Tue, Aug 13, 2013 at 6:20 PM, Patrick Flaherty
<[email protected]> wrote:
> I am using Stata 13/IC on Windows but I have had the same problem with
> earlier versions. When I try to loop through a local of two word
> phrases to put titles on graphs, I can't seem to get the behavior I
> want.
>
> Example:
>
> clear all
> sysuse auto, clear
> local makename "AMC Concord" "AMC Pacer" "Buick LeSabre" "Cad. Deville"
local makename `""AMC Concord" "AMC Pacer" "Buick LeSabre" "Cad. Deville""'
>
> forvalues m = 1/4{
> local cname: word `m' of `makename'
> twoway scatter mpg price, title(`"Fake `cname' Data"') name(graph_`m')
> }
>
> This produces four graphs. The first one titled
> Fake AMC Data, but I want it to say Fake AMC Concord Data
>
> The second the title is Fake Concord" Data -- that extra double quote
> shows up in other graphs I tried to create as well. Usually the extra
> double quote appears at the end of the title of the first graph in a
> loop.
>
> The third and fourth graphs look fine -- AMC Pacer and Buick LeSabre
> are correct, but of course there is no Cad. Deville, which is what I
> wanted for graph 4.
>
> When I change 1/4 to 1/5 the Cad. Deville graph is correctly drawn but
> now I have 5 graphs when I only wanted 4.
>
> If anyone knows what I'm doing wrong I would appreciate some help.
>
> Thanks!
>
> Patrick J. Flaherty
> Coventry, Connecticut
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/