Page 1 of 1

FOR Loops

Posted: Thu May 17, 2012 11:27 am
by John Lewis
Hi everyone!

I have a number of string values in a series Z (say, Z(1)="firms", Z(2)="cars", Z(3)="legs", Z(4)="shops").

At the same time, I need to use the following FOR statement:

FOT %ARQ firms cars legs shops
....
NEXT

Could you please help how to use this Z series in the FOR statement instead of listing all the string values in the line?

Thank you for all kinds of help!

Re: FOR Loops

Posted: Thu May 17, 2012 11:56 am
by EViews Gareth
If they're actually in an alpha series, it is not easy to do with a string loop. You can do it with a number loop though:

Code: Select all

for !i=1 to @obsrange %arq = z(!i) next

Re: FOR Loops

Posted: Thu May 17, 2012 12:41 pm
by John Lewis
Thanks a lot!

Unfortunately I have a problem with aplling @obsrange to a alpha-series Z. EViews states: "Alpha sent to a function which operates on a matrix". Could you please help with this? How to obtain correctly the lenght of an alpha series?

Thank you very much!

Re: FOR Loops

Posted: Thu May 17, 2012 1:49 pm
by EViews Gareth
@obsrange doesn't require an argument. It doesn't need to be applied to a series. It just tells you the length of the workfile (all series are the same length as the workfile).