Page 1 of 1

specify alphanumeric/numeric data for import

Posted: Wed Apr 07, 2010 1:26 pm
by minijim
Hi,
I have a problem when I try to import a text file in EViews :

Code: Select all

wfopen(type=text) "data.txt" delim=tab na="NULL" names=("num1","num2","alpha1","alpha2","alpha3","pikachu","num4")
(In fact there are 110 series in my text file);
pikachu contains numerical data (with some missing values), but EViews creates a alphanumerical series for this column.

I saw in EViews Command Reference that the option rformat seems to allow the specification of strings or numbers in the series, but I do not manage to use it : I tried
rformat=(pikachu# 9),
rformat=("pikachu"# 9),
rformat=(num1 1 num2 2 alpha1 3 alpha2 4 alpha3 5 pikachu# 6 num4 7)
but the error message
Syntax error: unexpected character '(' in rformat specification in "wfopen(type=text) "data.txt" delim=tab rformat=(pikachu# 9) na="NULL" names=("num1","num2","alpha1","alpha2","alpha3","pikachu","num4")
appears at each execution.

Is there a way to specify in this command that pikachu is a numerical series ?
(I know I could convert the alpha series in a numerical one using

Code: Select all

series pikachu2=@val(pikachu)
but there is probably an easier and neater way to do it ?)

Thanks in advance

Re: specify alphanumeric/numeric data for import

Posted: Wed Apr 07, 2010 1:37 pm
by EViews Gareth
I would guess it would be :

Code: Select all

rformat=(num1 1 num2 2 alpha1 3 alpha2 4 alpha3 5 #pikachu 6 num4 7)
but I haven't tested it (and nor do I believe I have ever used the rformat thing before). If it doesn't work, post a snippet of your data, and I'll play around.

Re: specify alphanumeric/numeric data for import

Posted: Thu Apr 08, 2010 1:19 am
by minijim
Thanks for your help; unfortunately it still does not work with #pikachu .
Here is an extract from my .txt file :
data.doc
(1.63 MiB) Downloaded 561 times
(it is not a .doc, but the extension .txt seems to not be allowed for attachments; you need to modify it in data.txt)

The "pikachu" column is the column 9, the other columns are well identified by EViews as numerical or alpha series.

Re: specify alphanumeric/numeric data for import

Posted: Thu Apr 08, 2010 8:09 am
by EViews Gareth
Rather than messing around with the rformat, just add "scan=all" to the end of your open line. So something like this:

wfopen(type=text) "data.txt" delim=tab na="NULL" names=("num1","num2","alpha1","alpha2","alpha3","pikachu","num4") scan=all

I think that will work for you.

I'm guessing you're using EViews 6? EViews 7 correctly recognised the 9th column for me.

Re: specify alphanumeric/numeric data for import

Posted: Thu Apr 08, 2010 9:09 am
by minijim
Thanks a lot Gareth, it works with scan=all (on EViews 6 indeed)