else if in eviews

For questions regarding programming in the EViews programming language.

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

Nau2306
Posts: 74
Joined: Thu Nov 17, 2011 11:51 am

else if in eviews

Postby Nau2306 » Thu Jul 12, 2012 11:30 am

I am using eviews 6. Is it possible to write an if statement with several else?

Here is the algorithm for what I am trying:
n00 = 0
n01 = 0
n10 = 0
n11 = 0
for i=2:250,
if ((indicator(i-1)==0) & (indicator(i)==0))
n00 = n00 + 1;
elseif ((indicator(i-1)==1) & (indicator(i)==0))
n10 = n10 + 1;
elseif ((indicator(i-1)==0) & (indicator(i)==1))
n01 = n01 + 1;
elseif ((indicator(i-1)==1) & (indicator(i)==1))
n11 = n11 + 1;
end
end

Thanks

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

else if in eviews

Postby EViews Gareth » Thu Jul 12, 2012 1:34 pm

Unfortunately not - you have to use nested complete if/else/endif statements.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests