WFOPEN function on CSV file changes column data type

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

tchaithonov
Posts: 168
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

WFOPEN function on CSV file changes column data type

Postby tchaithonov » Wed Jul 27, 2016 8:38 am

Hi All,

I am still using EViews 8.1 and I have this question I don't seem to have a way to solve.

I wrote a program that sucks in csv files (panel datasets with date id and cross id columns) into eviews, convert them into dated panel using pagestruct, but before I could do anything, I found out that the supposedly string cross id column has been converted into series by Eviews.

I understand that it's because I have a mixture of double quoted numerics and characters, and the latter don't appear until the end of the dataset.

I read the wfopen help page carefully, and saw that there is a quotes=double for html files, but I can't seem to make it work for csv's. The other way I see is to predefine the column type (using format=(A3), for instance), but I have csv files with different number of columns (more than 50+ files) and I can't predefine them all before I imported them.

Is there a way to solve this?

Thanks.

Tchaithonov

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

Re: WFOPEN function on CSV file changes column data type

Postby EViews Gareth » Wed Jul 27, 2016 9:48 am

You can try using the scan=all argument.
Follow us on Twitter @IHSEViews

tchaithonov
Posts: 168
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

Re: WFOPEN function on CSV file changes column data type

Postby tchaithonov » Wed Jul 27, 2016 11:02 am

Hi Gareth,

Thanks for the suggestion, but it doesn't seem to work.

I tried this:

Code: Select all

wfopen(scan=all) {%file}


it seems gives me a series for that column with NAs replacing all the characters.

Am I doing anything wrong with that code? Please let me know. Thanks.

Philip

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

Re: WFOPEN function on CSV file changes column data type

Postby EViews Gareth » Wed Jul 27, 2016 11:46 am

Follow us on Twitter @IHSEViews

tchaithonov
Posts: 168
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

Re: WFOPEN function on CSV file changes column data type

Postby tchaithonov » Wed Jul 27, 2016 12:17 pm

Yeah, I actually tried both ways

Code: Select all

wfopen(scan=all) {%file} ' which I showed above
wfopen {%file} scan=all


Not working.

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

Re: WFOPEN function on CSV file changes column data type

Postby EViews Gareth » Thu Jul 28, 2016 8:48 am

We'd need to see the file.
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 19 guests