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

Re: st: macro concat

From   Keith Dear <>
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."

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
_c:             `M1' `M2'

Michael Blasnik

----- Original Message ----- From: "Keith Dear" <>
To: <>
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'
*   For searches and help try:
*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index