loop with {!i-1}

For questions regarding programming in the EViews programming language.

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

contrapunctus
Posts: 3
Joined: Fri Mar 12, 2010 1:20 am

loop with {!i-1}

Postby contrapunctus » Tue Mar 23, 2010 12:45 pm

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.

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

Re: loop with {!i-1}

Postby EViews Gareth » Tue Mar 23, 2010 12:59 pm

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


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests