Variable naming importing from csv

For questions regarding programming in the EViews programming language.

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

Pieter
Posts: 3
Joined: Wed Feb 07, 2024 7:08 am

Variable naming importing from csv

Postby Pieter » Thu Feb 08, 2024 12:17 am

Hi
I am having some difficulties importing data from a csv file into an EViews workfile. The code works precisely the way it should in EViews 12 but in EViews 13 I am experiencing some issues. The programe file essentially import monthly data (from a csv file) starting in 2008 for 6 entities (same csv file is being used in both versions of EViews). There are 2 series per entity (let's call the series "income" and "expense") The programe file then rename the 6 entities to new names. Then after that EViews rename the imported series to "income" and "expense". In EViews 12 the work file then displays the new variable name with the corresponding entity (e.g. "_5111$income$abc" or "_5111$expense$abc"). This is then done for all 6 entities. In EViews 13 however, the variable name only shows "num1" to "num111" and not the name as indicated above ("_5111$income$abc" or "_5111$expense$abc"). I thought that it had to do with the "byrow" or "colhead" command, but it seems like the problem is elsewhere. Please see the extract of the code below. What is the solution for Eviews 13 and is there a possible solution that will work in both EViews 12 and EViews 13?

Your suggestions are highly appreciated.
Kind regards
Pieter


import(c=a, propnas) "C:\MyArea\2024 Model\database\Test300.csv" ftype=ascii rectype=crlf skip=2 fieldtype=delimited delim=comma byrow colhead=5 eoltype=pad badfield=NA @freq M 2008M1 @id @destid @date @smpl @all

rename *first_ent abc*
rename *second_ent def*
rename *third_ent ghi*
rename *fouth_ent jkl*
rename *fifth_ent mno*
rename *Sixth_ent pqr*

rename *_1_190_Test300_ _5111$income$*
rename *_1_98_Test300_ _5111$expense$*

delete *Test300*

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

Re: Variable naming importing from csv

Postby EViews Gareth » Thu Feb 08, 2024 10:52 am

Could you provide the csv?
Follow us on Twitter @IHSEViews

Pieter
Posts: 3
Joined: Wed Feb 07, 2024 7:08 am

Re: Variable naming importing from csv

Postby Pieter » Fri Feb 09, 2024 12:10 am

Hi Gareth. Thank you for your assistance. Much appreciated. Please see attached the csv file as well as the program file.
Attachments
Test300.csv
(17.72 KiB) Downloaded 17 times
incexp.prg
(466 Bytes) Downloaded 17 times

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

Re: Variable naming importing from csv

Postby EViews Gareth » Fri Feb 09, 2024 9:01 am

I can't really see how that worked in EViews 12 (and I ran it in 12, and the same behaviour as 13 occurred).

But, you probably want to use the colheadnames=( ) argument of the important statement to say which rows contain name information.
Follow us on Twitter @IHSEViews

Pieter
Posts: 3
Joined: Wed Feb 07, 2024 7:08 am

Re: Variable naming importing from csv

Postby Pieter » Sun Feb 11, 2024 11:36 pm

Thanks Gareth. I will play around with the colheadnames. I include a screenshot of EViews12 and EViews13 workfile output. Eviews13 is not creating the variable name in the workfile using the same programe file and same csv file as used in EViews12.
Attachments
Eview12 and EViews 13 output.xlsx
(169.17 KiB) Downloaded 21 times


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 28 guests