Loop inside loop

For questions regarding programming in the EViews programming language.

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

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Loop inside loop

Postby rmoralesaramburu » Mon Jan 06, 2014 1:45 pm

Hello,

I can't fill my matrix with this program, it just fills 1 data value in all the rows.

Code: Select all

matrix(18,3) tabledata for %y br co cz hu id ma mx pd pe ph ru sa si sk ta th us vn for !i=0 to 17 tabledata(!i+1,1) = @last(pend_long_{%y}) next next
What I am doing wrong?

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

Re: Loop inside loop

Postby EViews Gareth » Mon Jan 06, 2014 2:16 pm

The right hand side of the equality does not depend upon !i

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Loop inside loop

Postby rmoralesaramburu » Mon Jan 06, 2014 2:24 pm

Can you help me with the correct syntax?

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

Re: Loop inside loop

Postby EViews Gareth » Mon Jan 06, 2014 2:28 pm

Not without knowing what you are trying to do.

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Loop inside loop

Postby rmoralesaramburu » Mon Jan 06, 2014 2:46 pm

Thanks I already figure it out. This was the correct coding

Code: Select all

matrix(18,3) tabledata !i=-1 for %y br co cz hu id ma mx pd pe ph ru sa si sk ta th us vn !i=!i+1 tabledata(!i+1,1) = @last(pend_long_{%y}) next


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests