Dereferencing occurs at all levels as soon as you write down one or more
pairs of ` ' to indicate a local macro. It's not a question of peeling
one layer off at a time. If that were so, working with nested macros
would be more tedious.
Thus although you inserted the text "`something'" inside local macro A,
as soon as you write
`A'
Stata looks inside, sees `something' and dereferences that in turn, so
what you get is no surprise.
If you don't want dereferencing, don't refer to a local macro (until you
need its contents, that is).
You can delay dereferencing just once by using a backslash, but that
doesn't wire in lifelong protection. It works just once, as said.
As I don't recognise your need as one I've felt in 15 or so years of
Stata programming, I am tempted to say you are not missing anything. But
let me ask directly:
Why do you think you need this?
Nick
[email protected]
Alex Gamma
although I feel I must be overlooking something big,
despite checking [P] and [U] and the Statalist archives,
I wasn't able to figure out how I can simply get a local
macro A with content `something', but without expanding
`something' (something is a macro, too, that contains,
let's say, foo1 [. loc something foo1]).
I couldn't get it to work using "\".
If I code
. loc A \`something'
I will get, as desired,
. mac list _A
_A: `something'
But if I use A in code, e.g.
. loc s "`A'" + "foo2"
I get
.mac list _s
_s: "foo1" + "foo2"
instead of
_s: `something' + "foo2"
Likewise
. di "`A'"
returns
foo1
instead of
`something'
Is what I want impossible or even unnecessary?
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/