Missing Values

For questions regarding programming in the EViews programming language.

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

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Missing Values

Postby rmoralesaramburu » Fri Nov 22, 2013 1:27 pm

Hello

How do I program Eviews to manage NA values. I will like to fill NA values with the next "not NA" value, for example:

Series01
NA
NA
NA
NA
4
7
8
....

The NAs of this series has to be filled with number 4.

Series01
4
4
4
4
4
7
8

Thanks!

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

Re: Missing Values

Postby EViews Gareth » Sat Nov 23, 2013 11:47 am

Assuming that the last value in the series is not an NA, this will work:

Code: Select all

smpl @first @last-1 genr(r) series01 = @recode(series01=na, series01(1), series01) smpl @all

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Missing Values

Postby rmoralesaramburu » Mon Nov 25, 2013 8:47 am

Sorry, that only put the first value not equal to NA in the row before that first value, but I need to replace the others NA. So what the code did was the following

Series01
NA
NA
NA
NA
4
5
7

Series01 (after running the code)
NA
NA
NA
4
4
5
7

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

Re: Missing Values

Postby EViews Gareth » Mon Nov 25, 2013 9:33 am

Works for me:

Code: Select all

create u 7 series series01 series01.fill na, na, na, na, 4, 5, 7 smpl @first @last-1 genr(r) series01 = @recode(series01=na, series01(1), series01) smpl @all

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Missing Values

Postby rmoralesaramburu » Mon Nov 25, 2013 10:26 am

What is the (r) in genr(r) for? I am not getting it. I am attaching the excel, could you try for br_l for example?

Thanks!
Attachments
fi_latam.xlsx
(1.88 MiB) Downloaded 634 times

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

Re: Missing Values

Postby EViews Gareth » Mon Nov 25, 2013 10:51 am

The (R) stands for reverse - it tells EViews to generate the values starting at the bottom and working up.

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

Re: Missing Values

Postby EViews Gareth » Mon Nov 25, 2013 11:30 am

Looks like there is a slight issue with genr(r) on large workfiles with threading turned on. To get it to work, until we patch, go to Options->General Options->Advanced System Settings, then change the maximum number of threads to "1".

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Missing Values

Postby rmoralesaramburu » Thu Dec 19, 2013 10:11 am

Hello

I have a series with NA and non NA values on it. I would like fill the NA values interpolating, or repeating the previous value. How can I program it?

Thanks

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

Re: Missing Values

Postby EViews Gareth » Thu Dec 19, 2013 10:24 am

Look at series.adjust in the Object Reference.

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Missing Values

Postby rmoralesaramburu » Thu Dec 19, 2013 1:14 pm

I got it with ipolate function.

I am getting the following error when I try to generate a series:

"Missing data generated in "genr it_co_l=@mav(100*(col_li-@mmin(col_li,14*5))/(@mmax(col_li,14*5)-@mmin(col_li,14*5)),20)"

The series is created but it is stopping my program when I run it. I don't want it to stop

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

Re: Missing Values

Postby EViews Gareth » Thu Dec 19, 2013 2:40 pm

Increase the number of errors your program allows when running.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests