Loops

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

elnoch
Posts: 18
Joined: Tue Jun 21, 2016 6:54 am

Loops

Postby elnoch » Tue Jun 21, 2016 7:17 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Loops

Postby EViews Gareth » Tue Jun 21, 2016 7:51 am

Create another variable, !j = !i+1, and use that


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests