I'm trying to assign +1 values to a 'trade' series when my 'res' (=residual) series is greater than standard deviation (=s) and -1 when my 'res' series less than negative standard deviation
if res>s then
series trade=1
else
if res<-s then
series trade=-1
endif
endif
but getting a message "NA found in matrix IF RES>S then"
Is there a way to avoid the NA message?
NA in "if" statement
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
tchaithonov
- Posts: 168
- Joined: Mon Apr 13, 2009 7:39 am
- Location: New York City
Re: NA in "if" statement
use @recode instead.
Re: NA in "if" statement
@recode will work for the first time, but when I use it for the second, it will overwrite the first results.
Any other suggestions?
Any other suggestions?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13584
- Joined: Tue Sep 16, 2008 5:38 pm
Re: NA in "if" statement
Code: Select all
series trade = @recode(res>s, 1, 0)
series trade = @recode(res<-s,-1,trade)
Re: NA in "if" statement
Thank you for the help
Who is online
Users browsing this forum: No registered users and 1 guest
