Hi,
my series contains 1641 observations and some of them are NA-entries. I want to write a program that replaces them by zero. I tried it this way:
for !i = 1 to 1641
if @isna(@elem(series, !i)) then
@elem(series, !i} = 0
endif
next
Unfortunately, my code returns an error message, telling me that "an unnamed object cannot be converted to a string in IF...". What shall I do?
Replace NA by 0
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
Replace NA by 0
Code: Select all
X=@recode(X=na,0,X)
-
tchaithonov
- Posts: 168
- Joined: Mon Apr 13, 2009 7:39 am
- Location: New York City
Re: Replace NA by 0
Code: Select all
X=@nan(X,0)-
MoneyMarcus
- Posts: 2
- Joined: Tue Oct 12, 2010 6:31 am
Re: Replace NA by 0
Great, thanks for your fast help!
-
canboardrp
- Posts: 17
- Joined: Tue Mar 06, 2012 9:11 am
Re: Replace NA by 0
I got a number of series where I have this same problem and I've tried the recode approach as below and it hasn't worked. I'm still left with NA's in the series and it's throwing things off for me.
What have I got wrong in the programming?
Code: Select all
Nonwork=@recode(na,0,0)-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Replace NA by 0
Looks like you got the syntax wrong:
Code: Select all
X=@recode(X=na,0,X)
Who is online
Users browsing this forum: No registered users and 2 guests
