importing panel data from excel

For questions regarding programming in the EViews programming language.

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

mikela
Posts: 14
Joined: Tue Jan 11, 2011 8:24 am

importing panel data from excel

Postby mikela » Mon Dec 15, 2014 7:37 am

hi,
i'm trying to write the command line to import a file structured like the excel here. i have two questions:

1) what type of workfile i need to create before using the import command (assuming i shall be using import), for now i'm using an annual workfile, but not sure it's right

2) when i try something like this

import L:\xxx\MichelaS\xxx\byCountry\AU\database.xlsm range="test" @id bankid @date(year) @destid bankid @date

i get the error "different number of id series provided for source and destination", i don't understand this error message, what are the source and destination ID series? my source ID would be BankID and the destination should also be BankID - yy right?
sorry but it's the first time i try to import data structured as panel.

many thanks
mikela
Attachments
panelTest.xlsx
(21.95 KiB) Downloaded 678 times

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

Re: importing panel data from excel

Postby EViews Gareth » Mon Dec 15, 2014 9:16 am

The command you have is fine (and works for me, just fine).

Is your copy of EViews up to date?

If so, could you provide the workfile you're importing in to?

mikela
Posts: 14
Joined: Tue Jan 11, 2011 8:24 am

Re: importing panel data from excel

Postby mikela » Tue Dec 16, 2014 1:35 am

my copy is Eviews 8, 64-bit, Jun 19 2013 build (not sure this is the latest).

i don't have a workfile as i create it in the program, so i'm basically running these two lines in my program

wfcreate(wf=australia) y 1999 2014
import L:\DRS\Users\MichelaS\Bankscope\byCountry\AU\panelTest.xlsx range="test" @id bankid @date(year) @destid bankid @date

and i get this error message "Different number of id series provided for source and destination in "IMPORT L:\DRS\....""

is it because the workfile i create is annual? what kind shall i be creating? undated?
thanks for your help!

michela

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

Re: importing panel data from excel

Postby EViews Gareth » Tue Dec 16, 2014 9:31 am

The destination workfile (the one you created) does not have a series called bankid

mikela
Posts: 14
Joined: Tue Jan 11, 2011 8:24 am

Re: importing panel data from excel

Postby mikela » Wed Dec 17, 2014 8:56 am

now i found an interim solution but I really don't understand the logic of eviews in creating a workfile and opening a workfile.
Why do you have two commands wfcreate and wfopen, it's just not clear (even though i see they are different commands).

Anyway, if i use the following command:

wfopen(page=AU) "L:\DRS\Users\ccc\Bankscope\byCountry\AU\database.xlsm" range="data"
this works and creates a nice workfile with a page structured as a panel and called AU

Since i need to import several pages (one for each country), if i write

wfopen(page=AU) "L:\DRS\Users\ccc\Bankscope\byCountry\AU\database.xlsm" range="data"
wfopen(page=CA) "L:\DRS\Users\ccc\Bankscope\byCountry\CA\database.xlsm" range="data"

I get two workfiles. So basically each time the program recreates a workfile. Now, my question is:
How do I create several pages in ONE workfile, in which each page would then be AU, CA, etc.? Is there any way i can say wfopen in a given wfile?

In a second step i'll have to merge all pages into one, but then i guess the command will be pageappend, but for now one thing at a time :|
many thanks!
m

mikela
Posts: 14
Joined: Tue Jan 11, 2011 8:24 am

Re: importing panel data from excel

Postby mikela » Wed Dec 17, 2014 9:05 am

i've got it! i have to use first

wfload "myworkfile"

and then

pageload(page=AU).....

and it adds pages to myworkfile!

thanks anyway!

michela

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

Re: importing panel data from excel

Postby EViews Gareth » Wed Dec 17, 2014 9:06 am

I would have thought the best thing to do is just use the import command without creating a workfile before hand.

mikela
Posts: 14
Joined: Tue Jan 11, 2011 8:24 am

Re: importing panel data from excel

Postby mikela » Wed Dec 17, 2014 9:08 am

i tried, but with import i still get an error message regarding the ids somehow...

Actually it also works by using only pageload recursively without opening or i shall say loading a workfile first, it just adds pages to the new workfile created by pageload.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest