Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: Macro escape inside a macro


From   Aleksander Rutkowski <alek.rutkowski@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: Macro escape inside a macro
Date   Wed, 29 Sep 2010 10:19:58 +0200

Eric, Nic, thank you for your replies. It appears that the beginning
of my original message did not reach statalist. I am resending it --
see below. BTW, I have read
http://www.stata.com/support/faqs/lang/backslash.html but it shows
only simple actions with -display- command, which work fine, but my
problem is more complicated. I want to delay substitution of a macro
which is nested in another macro -- see below. Why backslash works
when used with -display- but not with -local-? (In my example below I
want to expand x but not d). I tried to use -macval()- but I did not
succeed. The description of -macval()- in the [P] manual is very brief
and there is no example with a full syntax. Maybe somebody could give
an example how -macval()- should be used?

-- original message below --

Why:
  di "\`d'"
displays:
  `d'
but:
  local x "\`d'"
  di "`x'"
displays empty string?

How can I escape macro (i.e. prevent macro substitution) inside
another macro (i.e. when defining another macro)?

Aleksander Rutkowski
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index