EViews does not read some columns from a .csv.

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

youngil
Posts: 3
Joined: Thu Sep 19, 2024 11:43 pm

EViews does not read some columns from a .csv.

Postby youngil » Sun Sep 22, 2024 12:26 am

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 809 times

Data in EViews:
CSV_data_EViews_2024-09-22.png
CSV_data_EViews_2024-09-22.png (34.08 KiB) Viewed 809 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?

EViews Steve
EViews Developer
Posts: 820
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

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

Postby EViews Steve » Sun Sep 22, 2024 11:44 am

Please provide the CSV file, or maybe just the first 10 lines, so we can try to replicate the issue.

youngil
Posts: 3
Joined: Thu Sep 19, 2024 11:43 pm

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

Postby youngil » Sun Sep 22, 2024 1:59 pm

Hi, Steve
Here's a truncated version of the data file.
Thanks for the prompt response.
Attachments
Data_truncated.csv
(787.87 KiB) Downloaded 53 times

EViews Steve
EViews Developer
Posts: 820
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

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

Postby EViews Steve » Sun Sep 22, 2024 3:36 pm

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

youngil
Posts: 3
Joined: Thu Sep 19, 2024 11:43 pm

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

Postby youngil » Sun Sep 22, 2024 6:11 pm

Hi Steve,
"scan=all lastcol" is the solution and fixes the problem.
Thanks a lot for your prompt and exact response!
Best,
youngil


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 1 guest