prelist is born empty, or so the code
fragment presumes, but each time
round the loop it accretes the latest
name assigned by the preceding -tempvar-.
The double quotes are just a matter of style
on my part, as I like to underline to myself
-- and to any readers of the code -- that
the string interpretation is paramount.
As you say, it would work without them.
Nick
[email protected]
Joseph Coveney
> Nick Cox wrote (excerpted):
>
> use auto.dta, clear
> ologit rep78 price turn
> forval j = 1/`e(k_cat)' {
> tempvar pre
> local prelist "`prelist' `pre'"
> }
> predict `prelist'
>
> --------------------------------------------------------------
> -----------------
>
> Nick,
>
> You put the double quotes in -local prelist "`prelist'
> `pre'"- for a purpose.
> The code works at least in this case without them, and so I'm
> curious why you
> included them, what the potential pitfall is that they're
> there to guard against.
*
* 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/