Statalist


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

Re: st: macval() and passing text as is


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: macval() and passing text as is
Date   Sun, 1 Jun 2008 20:01:46 -0400

Salah--
as Ben points out, the place to intervene is upstream where the macro
is created:

file close _all
tempfile tmp
file open t using `tmp', write
loc rcmd "xx$Test"
file write t `"`macval(rcmd)'"' _n
loc rcmd "xx\$Test"
file write t `"`macval(rcmd)'"' _n
file close _all
type `tmp'

On Sun, Jun 1, 2008 at 4:35 PM, Ben Jann <ben.jann@gmail.com> wrote:
> On Sun, Jun 1, 2008 at 8:58 PM, Salah Mahmud <salah.mahmud@gmail.com> wrote:
>> If I understood you correctly, there is nothing that could be done
>> from within an ado module to overcome the problem. So it would be up
>> to the user of the ado to pass any $-containing arguments within a
>> macval() call.
>
> ... or use the "\" macro exapansion escape character. Example:
>
>  . myprog, option(blah\$blah)
>
> would preserve the $ (provided that macval() is used throughout in -myprog-).
>
> ben
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index