Page 1 of 1

else if in eviews

Posted: Thu Jul 12, 2012 11:30 am
by Nau2306
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

else if in eviews

Posted: Thu Jul 12, 2012 1:34 pm
by EViews Gareth
Unfortunately not - you have to use nested complete if/else/endif statements.