Page 1 of 1

Open file with forced alphas

Posted: Thu Oct 21, 2010 3:34 pm
by javiersan
Hello,

I have several tsv (tab-separated) files with data that has notes, for example a tab separated field can have a value of "125 a" and another field is "127". When I wfopen the file sometimes the series with notes are read as alphas and sometimes as series with the annotated fields read as NAs. I would like to force Eviews to read all the file as a set of alphas which then I will clean (remove the note indicators) and transform back into series. I can't figure out the syntax for this, could you please help?

The actual files I am actually working with are those of the Eurostat database that can be found in here:
http://epp.eurostat.ec.europa.eu/NavTre ... 1&dir=data

Thanks,

Javier

Re: Open file with forced alphas

Posted: Thu Oct 21, 2010 3:47 pm
by EViews Gareth
Any column that has an alpha character in it will be opened as an Alpha. There is a possible explanation for what is happening though.

When opening a file, EViews doesn't scan every row to decide whether something is an Alpha or a Series. Rather it does the first X rows (can't remember exactly how many), since reading every row just to decide whether it is an Alpha or not is time consuming. If a column doesn't have any characters (i.e. there are no annotated rows) in the first X rows, EViews will assume that that column is a Series. You can force it to scan every row with the scan=all option.

Re: Open file with forced alphas

Posted: Thu Oct 21, 2010 5:15 pm
by javiersan
Thanks Gareth, I'll try that.

Re: Open file with forced alphas

Posted: Fri Oct 22, 2010 9:52 am
by javiersan
Unfortunately it doesn't seem to work like that for me.

Take for example the .tsv file zipped in here
http://epp.eurostat.ec.europa.eu/NavTre ... p_k.tsv.gz
it is 10mb when unzipped so too large for attachment. It is better if you can open it in Excel for following up the data I refer to.

For example the elements corresponding to "NSA,EUR_HAB_CLV00,B1G,SI" in row 24 for 2010q2, 2010q1,...,2008q1 are a mix of numbers and letters but Eviews will read each column as a series and replace the cells with annotations with NAs.

There are two ways I think I can read this file:

Code: Select all

workfile(wf=Test) u 243 read(t,t=txt,d=t) namq_gdp_k.tsv 9789
where all the data is read as series (I lose the alpha with the dates)

or

Code: Select all

wfopen namq_gdp_k.tsv scan=all
where the data is read transposed, I keep the date alphas but again I lose all the series that have notes.

So, is there a way of reading every single column/row of the .tsv file as alphas?

Thanks,

Javier

Re: Open file with forced alphas

Posted: Fri Oct 22, 2010 10:26 am
by EViews Gareth
ok, we'll do it the proper way :D

Code: Select all

wfopen namq_gdp_k.tsv colhead=1 format=(242A)
where format=252A tells EViews that you have 242 columns that you want to treat as Alphas. You could do something like format=(230A, 2F, 10A) which says that you have 230 columns to treats as Alphas, followed by 2 to be treated as Series, then 10 more Alphas.

On a separate note, you could actually tell EViews to ignore the annotations by indicating that "b" is a delimiter:

Code: Select all

wfopen namq_gdp_k.tsv colhead=1 custom="b" delim=white mult=on

Re: Open file with forced alphas

Posted: Fri Oct 22, 2010 2:04 pm
by javiersan
I knew it had to be possible! That's brilliant, thanks very much Gareth.

Re: Open file with forced alphas

Posted: Sat Oct 23, 2010 2:19 pm
by javiersan
Actually, the second method does not work well when the annotation has two characters (like "127 be" in say 2010q2). When doing

Code: Select all

wfopen namq_gdp_k.tsv colhead=1 custom="b" delim=white mult=on
the 127 will be stored in 2010q3.

The othermethod works fine.

Thanks,

Javier

Re: Open file with forced alphas

Posted: Sat Oct 23, 2010 2:30 pm
by EViews Gareth
you could change custom to be "b, e", I think.