Page 1 of 1

loop with {!i-1}

Posted: Tue Mar 23, 2010 12:45 pm
by contrapunctus
Hello,

¿How do you type A(t-1) in a loop of equations?

I want to calculate these equations:


A_2009=c(1)+c(2)*B_2008
....
A_1988=c(1)+c(2)*B_1987


With this loop:

For !i=1988 to 2009

equation eq{!i}.ls A_{!i} c B_{!i-1}

next


¿how can you type B_i-1 in each equation?
Neither B_{!i-1} nor B_{!i}-1 works.

Thanks a lot.

Re: loop with {!i-1}

Posted: Tue Mar 23, 2010 12:59 pm
by EViews Gareth

Code: Select all

For !i=1988 to 2009 %aname = "A_" + @str(!i) %bname = "B_" + @str(!i-1) equation eq{!i}.ls {%aname} c {%bname} next