Page 1 of 1

importing from mixed numerical and alpha files

Posted: Thu Oct 29, 2009 9:14 am
by tgoodwin
I am having trouble importing tab delimited files either in .txt or .xls formats. The data has 25 columns with no headers. Some columns are alpha and some numeric. There must be some simple command lines to do this but the user's guide doesn't have much on alpha data.

Re: importing from mixed numerical and alpha files

Posted: Thu Oct 29, 2009 10:19 am
by EViews Glenn
From the Command Reference entry for read:
To import data into alpha series, you must specify the names of your series, and should enter the tag "$" following the series name (e.g., "NAME $ INCOME CONSUMP").

Re: importing from mixed numerical and alpha files

Posted: Thu Oct 29, 2009 10:47 am
by tgoodwin
I am working through the GUI. I have a work file set up as "series alpha." When I use the ACII Text Import on the text file data and insert NAME $ x1 x2 etc. it imports everything in NA. When I use the proc excel spreadsheet import on the data in excel using that naming line it imports everything as series and so the alpha data is all NA.

Re: importing from mixed numerical and alpha files

Posted: Fri Oct 30, 2009 8:25 am
by EViews Glenn
I'm not certain what's going on in your case, but my suggestion should work. I just tested a read of a file containing two rows:
1.2 <tab> abc <tab> 3.4
2.2 <tab> efg <tab> 5.5
Creating a new workfile using the "File/Open/Foreign Data as workfile" reads in three series (SERIES01, SERIES02, SERIES03), with the first and third series numeric and the second an alpha series.

Similarly, I can create a two observation workfile and use "Proc/Import/Read Text/Lotus/Excel...". I set the number of header lines to 0, and enter
"X Y $ Z" as the name string for the series, I obtain three series X Y and Z, where the first and third series are again numeric and the second is an alpha series.

Re: importing from mixed numerical and alpha files

Posted: Fri Oct 30, 2009 11:14 am
by tgoodwin
The File/Open/Foreign Data as workfile works perfectly. Thanks! :D

The Proc/Import/Read Text-Lotus-Excel did not work. I must have the naming syntax wrong. I listed the names as:
x01 $ x02 x03 x04 x05 x06 x07 x08 x09m x10 x11 x12 x13 x14 x15 $ x16 $ x18 $ x19 $ x20 $ x21 $ x22 $ x23 $ x24 x25
The intention is to read x01 and x15-x23 as alpha and the rest numeric. What am I doing wrong?

Re: importing from mixed numerical and alpha files

Posted: Fri Oct 30, 2009 3:53 pm
by EViews Glenn
That should be fine. I'm assuming that those series don't already exist in your workfile...