-macval()- may be what you are looking for.
See help on -macro-.
Otherwise postpone evaluation by using a
-char()- call for the left quote.
Nick
[email protected]
Sergiy Radyakin
> I have a dialog form, and an EDIT control on that form contains a
> string with possibly local macros embedded in it. E.g.
>
> "Text `alpha' other text"
>
> I need to save/read the contents of this field to/from text file.
> If I save the value directly, e.g.
>
> file write ConfigFile `" `"`.my_dlg.main.fi_save.value'"' "' _n
>
> , the macro, which is contained in the value is evaluated and the
> result of that is saved.
>
> If I preclude evaluation with a " \ ",
> file write ConfigFile `" `"\`.my_dlg.main.fi_save.value'"' "' _n
> then I have
> `.my_dlg.main.fi_save.value'
> in my file, which will be evaluated when the file is to be read (which
> is wrong).
> So how do I tell Stata, that the string that I want to save is the
> VALUE of an EDIT control (equally applies to all other controls and
> string properties) taken AS-IS with all locals left unevaluated? Note
> that
> classutil des .my_dlg.main.fi_save.value
> also shows the evaluated value, rather than the "contents" of
> the field
>
> For those who do not want to deal with the dialogs, here is a similar
> problem with locals:
>
> local b "bar"
> local f `"foo \`b'"' // Have to preclude with \
> di `"f is:`f'"'
> di `"b is:`b'"'
> di `"\f is:\`f'"'
> di `"\b is:\`b'"'
> local c "`f'"
> di `"c is:`c'"'
> // I want to see: foo `b'
>
> Any ideas how can I get the contents of the macro in this way without
> all macros that it contains being evaluated?
*
* 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/