replace NAs by 0 in for loop over multiple series

For questions regarding programming in the EViews programming language.

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

tzink
Posts: 28
Joined: Mon Oct 29, 2012 4:55 pm

replace NAs by 0 in for loop over multiple series

Postby tzink » Tue May 14, 2013 11:59 am

I couldn't quite piece together how to accomplish this seemingly simple task. I have multiple series that I want to replace NAs by 0.

I know for a single series I use
X=@recode(X=na,0,X)

But I can't figure out how to loop over a list of series I specify
Something like

Code: Select all

for %i SERIES1 SERIES2 SERIES3 %i=@recode(%i=na,0,%i) next
but that doesn't work, obviously.

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

Re: replace NAs by 0 in for loop over multiple series

Postby EViews Gareth » Tue May 14, 2013 12:29 pm

Put braces around the %i in the @recode line.

tzink
Posts: 28
Joined: Mon Oct 29, 2012 4:55 pm

Re: replace NAs by 0 in for loop over multiple series

Postby tzink » Tue May 14, 2013 1:58 pm

Great, thanks. I feel like eviews programming is full of these little tricks that are fairly impossible to figure out without asking...


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests