Delete any series with all NA entries.

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

fnarita
Posts: 15
Joined: Thu Jun 04, 2009 11:15 am

Delete any series with all NA entries.

Postby fnarita » Fri Jun 05, 2009 12:42 pm

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
Attachments
annual.wf1
(1.41 MiB) Downloaded 489 times

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

Re: Delete any series with all NA entries.

Postby EViews Gareth » Fri Jun 05, 2009 1:35 pm

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.

fnarita
Posts: 15
Joined: Thu Jun 04, 2009 11:15 am

Re: Delete any series with all NA entries.

Postby fnarita » Fri Jun 05, 2009 2:14 pm

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


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests