exception to a FOR loop

For questions regarding programming in the EViews programming language.

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

Ingolstadt
Posts: 12
Joined: Tue Nov 04, 2008 10:09 am

exception to a FOR loop

Postby Ingolstadt » Wed Jul 15, 2009 4:17 pm

hi,

any ideas how i could include an exception for a loop, because atm i have to rewrite the code for every single case. short example:

for !j = to 4
for !i = 1 to 30
eq.ls(n) pd!k c pdl(series4, 4, 2) pdl(series!i, !j, 2)
next
next

in this example, my loop gets an error ofc, because i can't include the same variable a second time. what i need would be something like:

for !i = 1 to 30 'except' 4

it would rly help a lot, thx in advance.

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

Re: exception to a FOR loop

Postby EViews Gareth » Wed Jul 15, 2009 4:35 pm

just use an if statement

Code: Select all

for !j = to 4
for !i = 1 to 30
if !i <> !j then
      eq.ls(n) pd!k c pdl(series4, 4, 2) pdl(series!i, !j, 2)
endif
next
next
Follow us on Twitter @IHSEViews

Ingolstadt
Posts: 12
Joined: Tue Nov 04, 2008 10:09 am

Re: exception to a FOR loop

Postby Ingolstadt » Thu Jul 16, 2009 1:30 am

again the simplest way is the best :D thx


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 45 guests