Importing (undated) text from a table

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

Danxxx
Posts: 11
Joined: Mon Jun 07, 2010 10:06 am

Importing (undated) text from a table

Postby Danxxx » Fri Jul 02, 2010 11:14 am

I'm making a table (or maybe an excel file) with mostly text data, which looks like

BANK OLD_NAME NEW_NAME
global a542xx x_kor
intl a111ggg gdp_usa

[in fixed font they line up in 3 columns]

I want to get this data into usable form, then make a loop that imports data from different databanks (e.g. first I'll get a542xx from the global bank and rename it as x_kor; etc)

All I've come up with is to make string vectors (probably named BANK, OLD_NAME, NEW_NAME) and fill them up one cell at a time
bank(1) = dattab(2,1)
bank(2) = dattab(3,1)
[of course I'd do this with a loop]

Are there any better methods I could use?
Thanks,
Dan [EV7.1]
PS: how would Eviews know when the loop reaches the end of the table?

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

Re: Importing (undated) text from a table

Postby EViews Gareth » Fri Jul 02, 2010 11:38 am

Assuming that dattab is a table object, I don't see why you need to put it into a string vector - you could work straight from the table. Also, you could end the loop when you hit an empty cell of the table. Something like:

Code: Select all

Irow = 1 %bank = dattab(!row,1) %oldname = dattab(!row,2) %newname = dattab(!row,3) while @len(%bank)>0 rename {%oldname} {%newname} !row = !row+1 %bank = dattab(!row,1) %oldname = dattab(!row,2) %newname = dattab(!row,3) wend

Danxxx
Posts: 11
Joined: Mon Jun 07, 2010 10:06 am

Re: Importing (undated) text from a table

Postby Danxxx » Fri Jul 02, 2010 4:49 pm

That looks pretty good. I guess I assumed I would need a list of the banks, a list of oldnames, etc but I really don't. Thanks.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests