Page 1 of 1

EViews does not read some columns from a .csv.

Posted: Sun Sep 22, 2024 12:26 am
by youngil
Hi,

I've got an issue with reading a .csv file.

The csv file contains daily data from 05/04/1964 to 09/20/2024 of 64 series. The first column is "Date" formatted as yyyymmdd. The problem is EViews does not read columns after "EXR".

I'm using EViews version 13 at home and version 14 at work. Both versions have the same problem.

Data in CSV file:
CSV_data_2024-09-22.png
CSV_data_2024-09-22.png (52.35 KiB) Viewed 43327 times

Data in EViews:
CSV_data_EViews_2024-09-22.png
CSV_data_EViews_2024-09-22.png (34.08 KiB) Viewed 43327 times

Currently, I have the following line, where %freq is one of "A" "Q" "M" "D":

Code: Select all

import %tmp_file ftype=ascii rectype=crlf skip=0 fieldtype=delimited delim=comma colhead=1 namepos=all eoltype=pad badfield=NA @freq {%freq} @id @date(date) @smpl @all
The line works well with frequencies "A" "Q" "M", except "D". My guess is it is because of many blanks at the beginning of the daily data after "EXR".

I have tried the followings as well:

Code: Select all

wfopen(scan=all) %tmp_file
The same result as shown above.

Code: Select all

read(name, label=1) %tmp_file 1000
This reads all columns but fails to treat the first "Date" column as dates.

Any suggestion?

Re: EViews does not read some columns from a .csv.

Posted: Sun Sep 22, 2024 11:44 am
by EViews Steve
Please provide the CSV file, or maybe just the first 10 lines, so we can try to replicate the issue.

Re: EViews does not read some columns from a .csv.

Posted: Sun Sep 22, 2024 1:59 pm
by youngil
Hi, Steve
Here's a truncated version of the data file.
Thanks for the prompt response.

Re: EViews does not read some columns from a .csv.

Posted: Sun Sep 22, 2024 3:36 pm
by EViews Steve
Ok, I think the fact that your CSV file has a lot of values that are missing (NA) is causing the issue. Our import wizard tries to figure out how much data to import based on looking ahead and counting how many values exist for the first certain number of rows (I don't remember the exact row count) and judging from your data, it looks like the rows mostly only had data up to the EXR column, which is why the import wizard stopped there.

I noticed that the last few lines of data in the text file had more data values, so I reversed the order of the rows (after the header) and imported that. This resulted in a lot more columns being imported, but it still dropped a lot from the end since they didn't have any data.

I did find these two IMPORT elements (available during a text file import, see here) which, I believe, fixed the issue:

Code: Select all

scan=all
and

Code: Select all

lastcol

So your import command should look something like this:

Code: Select all

import "Data_truncated.csv" ftype=ascii rectype=crlf skip=0 fieldtype=delimited delim=comma colhead=1 scan=all lastcol namepos=all eoltype=pad badfield=NA @freq D7 @id @date(date) @smpl @all

Steve

Re: EViews does not read some columns from a .csv.

Posted: Sun Sep 22, 2024 6:11 pm
by youngil
Hi Steve,
"scan=all lastcol" is the solution and fixes the problem.
Thanks a lot for your prompt and exact response!
Best,
youngil