Page 1 of 1

Loops

Posted: Tue Jun 21, 2016 7:17 am
by elnoch
Hi,

I'm new programming in Eviews and I have a question concerning loops. Say for example that I have a group of 3x3 tables named Alpha1, Alpha2... and I want to access the element in the position (2,1) of each table with a loop during the first iteration:

Code: Select all

for !i=1 to 3 scalar a{!i} = Alpha{!i+1}(!i+1,1) ' next
Meaning that in the first iteration, I want to assign to the scalar a1 the value of the table Alpha2(2,1). However, I have the following message:
"Syntax error in "A{!I} = Alpha{!I+1}(!I+1,1)".

I've tried with a different syntax, and what I get is Syntax error in "A{!I} = Alpha(1+1)(!I+1,1) so I don't know why the program won't just sum up the 1+1 with a 2. Does anyone know how can I do this? I would appreciate any help.

Thank you.

Re: Loops

Posted: Tue Jun 21, 2016 7:51 am
by EViews Gareth
Create another variable, !j = !i+1, and use that