Page 1 of 1

Delete any series with all NA entries.

Posted: Fri Jun 05, 2009 12:42 pm
by fnarita
Hi,

Is there any command to delete any series that contains only NAs?

The excel files that I imported sometimes contain a series of all NAs. For example, there is a series of GDP in country A, whose GDP is not available in fact. In this case, my variable A_GDP contains NAs for all data periods. That is, @obs(A_GDP) = 0 in spite of the existence of A_GDP in the work file.

I'm wondering if I could write a loop all variable names in the current or "default" page, and delete the variable with @obs = 0. Or, I'd like to write a command statement like:

Code: Select all

delete * if @obs(*) = 0
altough this doesn't work.

Does anybody have a suggestion?
I will really appreciate any comments/suggestions.

I uploaded my work file. (Annual.wf1)
For example, ANT_Y only contains NAs.

I really appreciate all the helps that I got from this forum.
Thank you very mcuh,
Futoshi

Re: Delete any series with all NA entries.

Posted: Fri Jun 05, 2009 1:35 pm
by EViews Gareth

Code: Select all

group g * for !i=1 to g.@count %name = g.@seriesname(!i) if @obs({%name}) = 0 then d {%name} endif next
This will work unless you have alpha series in your workfile, in which case it will error. To get around this you can either adjust the group, G, to take out the alpha series, or you can run the program with a high error count.

Re: Delete any series with all NA entries.

Posted: Fri Jun 05, 2009 2:14 pm
by fnarita
Thank you very much!!!

I just started using EViews one week ago, and learned a lot from you, QMS Gareth.
I truely appreciate your quick and precise help!

Thank you so much for taking your time, and have a nice weekend!
Futoshi