[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: RE: local macro in nlcom [nlcom bug?] Response to Nick
Jun Xu <email@example.com> is having some trouble with local macro
expansions while using -nlcom-, pointing to out that the most likely source of
the problem is the following line in a program Jun wrote:
> local ai = "1/exp(-_b[/lnalpha])"
The program later uses this macro in an expression for -nlcom-.
> nlcom ///
> ((exp(lngamma(`i'+`ai'))/(exp(lnfact(`i'))*exp(lngamma(`ai'))))* ///
> ((`ai'/(`ai'+`expxb'))^`ai')* ///
There problem is in the following piece of the above expression
In particular, when Stata expands the contents of local macro -ai-, it cannot
know that `ai' should probably be bound in parentheses; Stata expands macros
"as-is". This is easily solved by explicit binding.
local ai = "( 1/exp(-_b[/lnalpha]) )"
* For searches and help try: