Loop with changing index inside
Posted: 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
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