Hello, I have a simple question
Is there any way to loop by irregular numbers?
for example: (It has a syntax error)
for !i= 1, 3, 7, 11, 13, 15, 20, 21, 29
series x{!i}=@nrnd
series y{!i}=0.9*x{!i}
next
How do I loop the program using control variable i, using irregular numbers?
Thank you for your attention.
for loop control
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: for loop control
Code: Select all
for %i "1 3 7 11 13 15 20 21 29"
series x{%i}=@nrnd
series y{%i}=0.9*x{%i}
next
-
malyang713
- Posts: 7
- Joined: Thu Mar 06, 2014 5:14 pm
Re: for loop control
Thank you for your kind reply.
However, it doesn't work.
The error occurs: "Syntax error in "SERIES X{%I}=@NRND.""
How do I can fix this?
However, it doesn't work.
The error occurs: "Syntax error in "SERIES X{%I}=@NRND.""
How do I can fix this?
-
malyang713
- Posts: 7
- Joined: Thu Mar 06, 2014 5:14 pm
Re: for loop control
I think it is because of the space after "%i=" in the code. But after fixing that, it still doesn't work.
Error: "Numeric operator applied to string data in "SERIES X{%I}=@NRND.""
Error: "Numeric operator applied to string data in "SERIES X{%I}=@NRND.""
-
malyang713
- Posts: 7
- Joined: Thu Mar 06, 2014 5:14 pm
Re: for loop control
I used the code:
for %i "1 3 7 11 13 15 20 21 29"
series x{%i}=@nrnd
series y{%i}=0.9*x{%i}
next
But it doesn't work
Error: Syntax error in "SERIES X{%I}=@NRND".
for %i "1 3 7 11 13 15 20 21 29"
series x{%i}=@nrnd
series y{%i}=0.9*x{%i}
next
But it doesn't work
Error: Syntax error in "SERIES X{%I}=@NRND".
-
malyang713
- Posts: 7
- Joined: Thu Mar 06, 2014 5:14 pm
Re: for loop control
After erasing ""s, the code works.
Thank you for your kind reply.
Thank you for your kind reply.
Who is online
Users browsing this forum: No registered users and 2 guests
