Or, if your index is something like of a geometric series as it seems to
be (let's say 6, 12, 24, 48, and so on) and too long to do manually
you can try this one:
<script>
scalar count=0
loop for (count=6;count<=24;count=count*2) --quiet
<instructions>
endloop
<\script>
cheers,
artur
Riccardo (Jack) Lucchetti a écrit :
On Tue, 25 May 2010, Henrique Andrade wrote:
> Dear Gretl Community,
>
> I'm trying to use a loop index inside a script but I don't know how.
> According
> to "Gretl User’s Guide" the syntax looks like this:
>
> loop i=1..24
>
> But I just need the points where "i" is equal to 6, 12 and 24.
> Something like this:
>
> loop i=6;12;24
>
> How can I do that?
For example, this way:
<script>
matrix foo = { 6, 12, 24 }
n = cols(foo)
loop for i=1..n
bar = foo[i]
print bar
end loop
</script>
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti
------------------------------------------------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users