Stephen P. Jenkins wrote
> I am going through the code for -sureg-
> in detail (hoping to adapt some of it
> for my own uses!). (Similar code appears
> in related commands.) I have two queries:
> (1) Why is there no -markout- line to
> accompany the -markout- one?
> [Is it because this is handled via
> -reg3-, which -sureg- calls?]
> (2) What is the undocumented "c_local"
> command used in the short IsStop
> auxiliary programme used at the end?
> Can "local" be used instead? [The
> IsStop program in -reg3- is very
> similar, but uses local rather than
> c_local.] -findit c_local- is empty.
On question (2), -c_local- defines a macro in the calling routine such that
you could code
prog def myprog
c_local mymac "whatever"
end
and then call -myprog-
. myprog
. di "`mymac'"
whatever
The reason -c_local- is undocumented might be that StataCorp considers it to
be dangerous given that it may overwrite a macro of the same name in the
calling routine. Arguably, it can be viewed as safer than the alternative
which involves using global macros to pass arguments to between the routine
and a sub. I say safer since a macro defined by c_local remains a local
macro and excludable to all programs except the calling one.
Patrick Joly
[email protected]
[email protected]
*
* 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/