Jun Xu <[email protected]> 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')* ///
> ((`expxb'/(`ai'+`expxb'))^`i'))
There problem is in the following piece of the above expression
> ((`ai'/(`ai'+`expxb'))^`ai')
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]) )"
--Jeff
[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/