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

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

From   "Salah Mahmud" <>
Subject   Re: st: macval() and passing text as is
Date   Sun, 1 Jun 2008 13:58:27 -0500

Thanks. That is helpful.

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.


On Sun, Jun 1, 2008 at 1:10 PM, n j cox <> wrote:
> -macval()- is still supported and still documented. Start with the help for
> -macro-.
> I don't know what you mean precisely by "does not work", as you don't say.
> What you have should work for a local called -rcmd-. I don't think it will
> work for a global. That is, a local that itself contains ` ' or $ will be
> echo without interpretation to the file you are writing to.
> Your posting refers to rcmd and Rcmd. I don't know whether your problem
> arises from a typo. I guess not.
> But in general macro evaluation takes place before anything else is done.
> That's the whole point, more or less, from Stata's angle, awkward though it
> may be for your purposes.
> Kit Baum, Bill Rising and I grappled with this in developing -log2html- on
> SSC and used -macval()-. That approach works fine in echoing $ signs as
> typed for our purposes, but I doubt that will help you in your problem,
> unless what you do is read in a .do file and then process it line by line.
> -string asis- and -passthru- within -syntax- have no bearing on this.
> The key detail here, as above, is that -syntax- works on a command line
> after all locals and globals have been interpreted, so nothing within
> -syntax- can possibly reverse that. -syntax- will never see or even know
> about e.g. $ characters that were typed on the command line.
> Nick
> Salah Mahmud
> I'm trying to save a string that may contain a Stata reserved
> characters (eg $) into a text file.  The problem is Stata keep
> intrepreting the string so the string "xx$Test" is interpreted into
> "xx".
> I tried coding
>  file write `rfhandle' `"`macval(rcmd)'"' _n
> but this still does not work. I could not find a Help description of
> macval. Is it still supported? Why the above line does not work?
> rcmd in the above line is passed as an option to this ado file so
> there is an Rmcd(string) in the syntax statement. My question when
> does Stata interpret the string stored in rcmd? if this happen when
> the ado is called then it might be too late to use the macval in the
> ado body. If this is the case, is there away of passing the rcmd
> option without interpretation? string asis does not seem to work. ?
> passthrough?
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

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