@nan function

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

Martin
Posts: 11
Joined: Wed Apr 08, 2009 12:05 pm

@nan function

Postby Martin » Thu May 28, 2009 7:14 am

A daily variable is available in excel format for each year; in other words one spreadsheet per year. Time period is from 1967-2008. I created a workfile with this range and created a series for each year that has observed values for that year and N/A for every other observation. I would now like to merge every series.

Is their another function like @nan? Or a procedure I can follow to merge these series so I will have a value for each observation?


Thank you
Martin

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: @nan function

Postby startz » Thu May 28, 2009 7:55 am

A daily variable is available in excel format for each year; in other words one spreadsheet per year. Time period is from 1967-2008. I created a workfile with this range and created a series for each year that has observed values for that year and N/A for every other observation. I would now like to merge every series.

Is their another function like @nan? Or a procedure I can follow to merge these series so I will have a value for each observation?


Thank you
Martin
You can change the NAs to zeros, and then add the series. Something like

Code: Select all

series allyears = @nan(y1,0)+@nan(y2,0)

Martin
Posts: 11
Joined: Wed Apr 08, 2009 12:05 pm

Re: @nan function

Postby Martin » Thu May 28, 2009 9:18 am

Thank you Startz.

Unfortunately, some values need to remain N/A. In a specific year, one or two days of data might be missing. Is there another method to merge the series? I have been use @nan over and over. It gets the job done but it is time consuming.

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

Re: @nan function

Postby EViews Gareth » Thu May 28, 2009 9:36 am

It seems you've gone about this somewhat backwards.

I think what I would do would be to create an EViews page for each year (i.e. an EViews page for each Excel sheet you have). Then you can use the EViews page append to append all those pages into one big page.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: @nan function

Postby EViews Glenn » Thu May 28, 2009 9:40 am

Gareth is correct, but given where you are at the moment, if I understand the exercise correctly, the @RMEAN (or @RSUM) function should do what you want...

Suppose we have the two series X1 and X2 where we have

Code: Select all

X1 X2 ------- 1 NA 2 NA NA 3 NA 4 NA NA
Form a group containing the two series

Code: Select all

group allseries x1 x2
Then the command

Code: Select all

series joined = @rmean(allseries)
will create

Code: Select all

JOINED -------- 1 2 3 4 NA
Note that this works assuming that there is at most one value in the group that is valid for a given observation. You can check this restriction using @ROBS.

Martin
Posts: 11
Joined: Wed Apr 08, 2009 12:05 pm

Re: @nan function

Postby Martin » Thu May 28, 2009 10:36 am

Gareth is correct, but given where you are at the moment, if I understand the exercise correctly, the @RMEAN (or @RSUM) function should do what you want...

Suppose we have the two series X1 and X2 where we have

Code: Select all

X1 X2 ------- 1 NA 2 NA NA 3 NA 4 NA NA
Form a group containing the two series

Code: Select all

group allseries x1 x2
Then the command

Code: Select all

series joined = @rmean(allseries)
will create

Code: Select all

JOINED -------- 1 2 3 4 NA
Note that this works assuming that there is at most one value in the group that is valid for a given observation. You can check this restriction using @ROBS.


PERFECT! Seriously you’re my hero.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests