Loop with changing index inside

For questions regarding programming in the EViews programming language.

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

jenny
Posts: 4
Joined: Mon Oct 29, 2012 4:33 pm

Loop with changing index inside

Postby jenny » Mon Dec 10, 2012 11:30 am

Hi,

I am trying to run this loop where a counter inside the loop is changing values for the columns in the matrix. But I am having no luck, the code loops through "FXAUS FXBRZ FXCAN FXCHI" but it doesn't change to the next column in the matrix. So "j" doesn't change from 1 to 2, 3, 4 every time the larger loop is finished. What do I do?

for %a FXAUS FXBRZ FXCAN FXCHI
scalar j=1


matrix(500,500) vecstat
for !i=22 to 500
equation reg.ls lnvar c var_!i ar(1) ar(2)
vecstat(!i,j)=reg.@tstat(2)
next

j=j+1
next

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Loop with changing index inside

Postby EViews Glenn » Mon Dec 10, 2012 12:13 pm

You are resetting j=1 every time through the loop.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests