Page 1 of 1

@iif

Posted: Thu Mar 21, 2019 9:12 am
by tvonbrasch
Hi

Why is the code below generating an error? I thought the @iif command only does the calculation if a is not equal to 0...?

I have been inspired by the code in forum post http://forums.eviews.com/viewtopic.php? ... ice#p36003. However, many of my "a"-series hold zero values and are thus creating these error messages. what is the best way of overcoming this problem?

Thomas


Skjermbilde.PNG
Skjermbilde.PNG (9.25 KiB) Viewed 3137 times

Code: Select all

wfcreate q 1970 2020 smpl @first 2000 genr b=na genr a=0 smpl 2000 @last genr b=2.5 smpl @all %first=b.@first %if =%first + " " +%first genr aux=@iif(a<>0, @mean(b,%if)/@mean(a,%if)*a,b)

Re: @iif

Posted: Thu Mar 21, 2019 9:20 am
by EViews Gareth
I don't get an error message if I run that code.

But, note, a test of a<>0 will return "na" if a=na, and so the @iif will return NA whenever a=na.