[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: macro concat
From
Keith Dear <[email protected]>
To
[email protected]
Subject
Re: st: macro concat
Date
Sun, 25 May 2008 12:59:12 +1000
Perfect, thank you. I don't even need the double quotes:
loc a \`M1'
loc c `macval(a)' `macval(a)'
mac list _c
_c: `M1' `M1'
(you can't do that with the list operators). With the macval name to
search by, I found this online (it was "new" in v8, when Stata went
object-oriented): "A new macro expansion function macval(lclname)
gives the contents of lclname as is, without recursive expansion."
kd
At 10:12 PM 24/05/2008, you wrote:
...
You need to use the macval function: Following the example below:
local c "`macval(a)' `macval(b)'"
macro list
<snip>
_c: `M1' `M2'
<snip>
Michael Blasnik
----- Original Message ----- From: "Keith Dear" <[email protected]>
To: <[email protected]>
Sent: Saturday, May 24, 2008 6:20 AM
Subject: Re: st: macro concat
No, that doesn't work:
. loc M1 hello
. loc M2 goodbye
. loc a \`M1'
. loc b \`M2'
. loc c `a' `b'
. mac list
_c: hello goodbye
_b: `M2'
_a: `M1'
_M2: goodbye
_M1: hello
But I want:
_c: `M1' `M2'
Keith
*
* 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 |