Re: [Gretl-users] loop question

2011-11-30 Thread Ignacio Diaz-Emparanza
El 30/11/11 13:06, Giuseppe Vittucci escribió: > Clearly, you can follow Jack's suggestion. > In my suggestion, i.e.: > > loop foreach i 48 60 100 250 400 780 > ... > endloop > > i is taken as a string. > But you can always recall it inside the loop using $i: > - defining a new scalar. E.g: >

Re: [Gretl-users] loop question

2011-11-30 Thread Giuseppe Vittucci
Clearly, you can follow Jack's suggestion. In my suggestion, i.e.: loop foreach i 48 60 100 250 400 780 ... endloop i is taken as a string. But you can always recall it inside the loop using $i: - defining a new scalar. E.g: loop foreach i 48 60 100 250 400 780 scalar j = $i ... e

Re: [Gretl-users] loop question

2011-11-30 Thread Jack
On Wed, 30 Nov 2011, Ignacio Diaz-Emparanza wrote: > I need to build a loop with a not regulary spaced index, ¿what do you > think it is the best way? > > I mean, for example a loop over i=48, 60, 100, 250, 400, 780 Something like this, perhaps? x = {48, 60, 100, 250, 400, 780} loop i=1..cols(

Re: [Gretl-users] loop question

2011-11-30 Thread Giuseppe Vittucci
loop foreach i 48 60 100 250 400 780 ... endloop Bye Giuseppe On Wed, 2011-11-30 at 11:21 +0100, Ignacio Diaz-Emparanza wrote: > I need to build a loop with a not regulary spaced index, ¿what do you > think it is the best way? > > I mean, for example a loop over i=48, 60, 100, 250, 400, 780

[Gretl-users] loop question

2011-11-30 Thread Ignacio Diaz-Emparanza
I need to build a loop with a not regulary spaced index, ¿what do you think it is the best way? I mean, for example a loop over i=48, 60, 100, 250, 400, 780 -- Ignacio Diaz-Emparanza DEPARTAMENTO DE ECONOMÍA APLICADA III (ECONOMETRÍA Y ESTADÍSTICA) UPV/EHU Avda. Lehendakari Aguirre, 83 | 48015

Re: [Gretl-users] Loop question

2010-05-26 Thread Jack
On Tue, 25 May 2010, Henrique Andrade wrote: > Dear Riccardo, Kehl and Guilherme, > > I was looking for something simple. The option "loop for (n=6; n<=24; > n*=2)" worked just fine. But in my humble opinion the option "loop for > (n=6; n=12; n=24)" should work too, but this is not a big deal ;

Re: [Gretl-users] Loop question

2010-05-26 Thread Allin Cottrell
On Tue, 25 May 2010, Henrique Andrade wrote: > I was looking for something simple. The option "loop for (n=6; > n<=24; n*=2)" worked just fine. But in my humble opinion the > option "loop for (n=6; n=12; n=24)" should work too, but this is > not a big deal ;-) The three fields in the "classic" f

Re: [Gretl-users] Loop question

2010-05-26 Thread Hélio Guilherme
I disagree with your proposed syntax. I should know that the current form of the loop for, comes from the C language (and then C++ and Java). I think that we could have something like: loop n in 6 12 24 xlist Where n is the loop variable 6, 12 and 24 are numbers, and xlist is a list of the same t

Re: [Gretl-users] Loop question

2010-05-25 Thread Jack
On Tue, 25 May 2010, Henrique Andrade wrote: > Now, because I just need the values for 6, 12 and 24, I'm trying to > substitute the second line "loop for (n=6;n<=24;n=n*2)" for this: > > loop for (n=6;n=12;n=24) > > But the script isn't working. Any hints? This, maybe? scalar m = 3 scalar bas

Re: [Gretl-users] Loop question

2010-05-25 Thread Kehl D ániel
.univpm.it Date: Tue, 25 May 2010 16:53:54 -0300 Subject: Re: [Gretl-users] Loop question Dear Riccardo, Kehl and Artur, Thanks a lot for your help! I'd tried all the options you gave me and my final script looks like this: scalar n=0 loop for (n=6;n<=24;n=n*2) --quiet scalar m = $T

Re: [Gretl-users] Loop question

2010-05-25 Thread Hélio Guilherme
Hi Henrique, I believe that this does what you want: loop for (n=6; n<=24; n*=2) --quiet No other simple options. On Tue, May 25, 2010 at 8:53 PM, Henrique Andrade wrote: > Dear Riccardo, Kehl and Artur, > > Thanks a lot for your help! I'd tried all the options you gave me and > my final scrip

Re: [Gretl-users] Loop question

2010-05-25 Thread artur bala
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: scalar count=0 loop for (count=6;count<=24;count=count*2) --quiet endloop <\script> cheers, artur Riccardo (Jack)

Re: [Gretl-users] Loop question

2010-05-25 Thread Henrique Andrade
Dear Riccardo, Kehl and Guilherme, I was looking for something simple. The option "loop for (n=6; n<=24; n*=2)" worked just fine. But in my humble opinion the option "loop for (n=6; n=12; n=24)" should work too, but this is not a big deal ;-) Thank you so much! Um abraço, Henrique Em 25 de maio

Re: [Gretl-users] Loop question

2010-05-25 Thread Henrique Andrade
Dear Riccardo, Kehl and Artur, Thanks a lot for your help! I'd tried all the options you gave me and my final script looks like this: scalar n=0 loop for (n=6;n<=24;n=n*2) --quiet scalar m = $T - n + 1 loop j=2..nelemY --quiet matrix R$n_$j = zeros(m,1) loop i=1..m --quie

Re: [Gretl-users] Loop question

2010-05-25 Thread Kehl D ániel
0200 (CEST) Subject: Re: [Gretl-users] Loop question 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: > > lo

Re: [Gretl-users] Loop question

2010-05-25 Thread Jack
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. Somet

[Gretl-users] Loop question

2010-05-25 Thread Henrique Andrade
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? Best rega