Danielle H. Ferry replied to Kit Baum
> > local rhs
> > * replace with number of firms
> > local nfirm 5
> > forv i=1/`nfirm' {
> > local rhs "`rhs' (xret`i' xmkt`i')"
> > }
> > di "`rhs'"
> > sureg `rhs',corr
> >
> > Note well the lack of an equal sign in the definition of
> local rhs.
> Is this so that the local variable <rhs> exists outside of
> the -forvalue-
> loop?
No, that's not the reason.
Within the loop the macro defined by
local rhs "`rhs' (xret`i' xmkt`i')"
can continue to grow to moderate length,
whereas the macro defined by
local rhs = "`rhs' (xret`i' xmkt`i')"
can be truncated: the = sign obliges
an evaluation of whatever is to the right of
here, and there is a length limit of 80 characters
(244 characters in Stata/SE) on strings to be evaluated.
See help on -limits-.
In this case, and many others, no evaluation is
needed, just substitution of macro
contents, so the = sign is not necessary.
And as it can do harm, by truncating the
string, it should definitely be avoided.
Nick
[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/