[Gretl-users] Question about bundles in loops
cottrell at wfu.edu
Tue Sep 18 20:28:49 EDT 2012
On Tue, 18 Sep 2012, Logan Kelly wrote:
> I am using version 1.9.9 on a Win 7 64 bit machine
> When I try
> loop m = 1..ModelCount
> bundle test
> I get the following error:
> Bare declarations are not allowed here:
>> 'bundle test'
>>> bundle test
OK, thanks, I see the issue -- and it's quite subtle. You can't
redeclare an already-declared variable (although it's fine to assign
it a new value, of course), so the above is not legit in a loop. The
difference in the variant I posted is that the declaration uses the
loop index (as a string) in naming the new variable ...
# do stuff
so gretl is clever enough to understand that this won't be the same
declaration over and over, it will be declaring a new bundle each
time round. That's what you have to do.
More information about the Gretl-users