Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Extended Function Macro's in Foreach: `: variable label `v''wrong?


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   st: RE: Extended Function Macro's in Foreach: `: variable label `v''wrong?
Date   Mon, 16 May 2005 09:13:55 +0100

Your problem is the extranious space between ` and : (note that this space is not there in your 'working' -display- example, where the colon has been mistyped as "), e.g.

. disp "` : word 1 of a b c'"


. disp "`: word 1 of a b c'"
a

The same is also true with `=<exp>':

. disp ` =2+2'


. disp `=2+2'
4

And with local macros:

. local mylocal hello

. disp "` mylocal'"


. disp "`mylocal'"
hello

Other than that, your code is fine. Hope this helps

David

-----Original Message-----
From: Orion Whitaker [mailto:[email protected]]
Sent: 15 May 2005 16:58
To: [email protected]
Subject: st: Extended Function Macro's in Foreach: `: variable label
`v''wrong?


I would like to label plots with the variables -label- using extended
functions in a 'foreach' loop.

Somehow this code does not give a title to the graph:

   foreach v of varlist age {
      display "`v'"
      graph box `v' , title(" ` : variable label `v' ' ")
      //  that's  dq lsq : variable label rlq v rsq rsq dq
      // as in dq: double quote   lsq:  left single quote
      }

I'm perplexed as I tried to 'mirror' code that worked for 'display',
namely
   display " `var' "  _col(20)  "`" type `var''"

Suggestions?


--
Orion C. Whitaker
Johns Hopkins School of Public Health
Johns Hopkins School of Medicine
[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/



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