Reading txt-file, special case

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

johansamuelsson
Posts: 165
Joined: Thu Mar 03, 2011 10:07 pm
Contact:

Reading txt-file, special case

Postby johansamuelsson » Tue Mar 04, 2014 3:27 am

Hi

I'm making a API-call via a VBA-script in order to get some data. The VBA-script creates a txt-file (see attached file).

I'm using

Code: Select all

wfopen "G:\Pro\Led\ProcessMetod\Api\Data\Data.Txt" skip=1 colhead=1 delim="," byrow pagestruct(freq=q, start=1993)
I have problem to tranforme the data from alphaseries to timeseries. I've tried using

Code: Select all

types = "f"
but Eviews transform wrong because I have space delimiter characters in the numbers?

How to do?

Regards Johan
Attachments
Data.txt
(16.31 KiB) Downloaded 433 times

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

Re: Reading txt-file, special case

Postby EViews Gareth » Tue Mar 04, 2014 9:03 am

Just so I understand correctly, the number:

Code: Select all

385 179
is actually one number (385179)?

johansamuelsson
Posts: 165
Joined: Thu Mar 03, 2011 10:07 pm
Contact:

Re: Reading txt-file, special case

Postby johansamuelsson » Tue Mar 04, 2014 11:31 am

Yes

EViews Chris
EViews Developer
Posts: 161
Joined: Wed Sep 17, 2008 10:39 am

Re: Reading txt-file, special case

Postby EViews Chris » Tue Mar 04, 2014 12:16 pm

I'm afraid you'll have to get rid of those spaces inside the numbers somehow. I don't remember anyone asking us to read in a numeric field formatted like that before and there's currently no built in support for it.

Actually, it turns out they're not ordinary spaces (character code 32) but non-breaking spaces (character code 160) inside your fields which makes it even less likely that we'll handle this automatically.

I think your only option within EViews is to translate the series yourself after loading them in, something like this

series import_av_varor_ = @val(@replace(import_av_varor, @chr(160), ""))

You could loop over all the series in a program by putting the series in a group and translating them within a loop.

johansamuelsson
Posts: 165
Joined: Thu Mar 03, 2011 10:07 pm
Contact:

Re: Reading txt-file, special case

Postby johansamuelsson » Tue Mar 04, 2014 12:46 pm

Ok, thanks


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests