import with NA as first obs

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

TimGrun
Posts: 36
Joined: Wed Sep 16, 2009 8:01 am

import with NA as first obs

Postby TimGrun » Thu Sep 09, 2010 6:20 am

I have a file imptest.txt which looks like:
testimport
NA
1
2
3
4
NA
5
6
7

Then in EViews I enter:
import(type=text,resize) imptest.txt @freq monthly 1960m1

This creates a variable testimportna!

What am I doing wrong?

Tim

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

Re: import with NA as first obs

Postby EViews Gareth » Thu Sep 09, 2010 7:09 am

try:

Code: Select all

import(type=text,resize) imptest.txt colhead=1 @freq monthly 1960m1

TimGrun
Posts: 36
Joined: Wed Sep 16, 2009 8:01 am

Re: import with NA as first obs

Postby TimGrun » Thu Sep 09, 2010 8:07 am

Thanks Gareth! Works great!

Tim

TimGrun
Posts: 36
Joined: Wed Sep 16, 2009 8:01 am

Re: import with NA as first obs

Postby TimGrun » Wed Oct 27, 2010 6:25 am

Hi Gareth,

The import command has worked great for most cases, but now I have a problem I can't figure out.

My data is only one observation and some of the values may be NA's.

gdp rff rtb rg10e
5 4 NA 3

The import command will make gdp, rff and rg10e numeric series and rtb will be a alpha series.
I want rtb to be a numeric series with the missing value, NA, as its only observation.

The import command I use: import(type=text,resize,mode=u) smallfile.txt colhead=1 @freq 4 2010q1
This type of command has worked for every other case I've tried to import.

Tim

TimGrun
Posts: 36
Joined: Wed Sep 16, 2009 8:01 am

Re: import with NA as first obs

Postby TimGrun » Wed Oct 27, 2010 9:59 am

OK, I think I figured it out.
On the import command I need to add a "format=<n>F" where <n> is the number of series I am reading. That forces the import to read all the values as numeric series as opposed to alpha series.

Is there a way to use a meta character like "*" to say format=(*F) and have all values series read in as numeric?

An observation: The documentation for format is way over in the wfopen documentation. I had no idea the format option was available for the import command. Some better cross referencing would be nice.

Tim

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

Re: import with NA as first obs

Postby EViews Gareth » Wed Oct 27, 2010 10:15 am

There is no way to specify all series.

I tend to agree on the documentation issue. Although wfopen, open, import, pageload, and to some extent, wfsave, save, pagesave all have almost identical options, and it was felt somewhat excessive to repeat those options in multiple pages, hence the the references to wfopen.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests