A table filled with values from different workfiles

For questions regarding programming in the EViews programming language.

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

alps
Posts: 28
Joined: Sun Feb 24, 2013 7:42 am

A table filled with values from different workfiles

Postby alps » Sat Mar 02, 2013 9:51 am

Hello,
I would like to create a table and fill it with values that are collected from different work files i.e. I will have a loop opening a series of files and copying these values into a table.
Could you help me how to do it.
Thanks a lot

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

Re: A table filled with values from different workfiles

Postby EViews Gareth » Sat Mar 02, 2013 10:20 am

Open the workfiles one at a time with the wfopen command, make a table containing the information you want, then copy the tables over to a master workfile with the copy command. Finally, merge the tables into one table with copytable or copyrange.

alps
Posts: 28
Joined: Sun Feb 24, 2013 7:42 am

Re: A table filled with values from different workfiles

Postby alps » Sat Mar 02, 2013 11:42 am

Sorry, it may sound stupid, I couldn't manage to copy the tables into a master workfile. How can I create a master workfile where only the tables will be copied to. That was my problem, earlier, I kept getting error messages when I wrote the copy command.
thanks a lot

alps
Posts: 28
Joined: Sun Feb 24, 2013 7:42 am

Re: A table filled with values from different workfiles

Postby alps » Sat Mar 02, 2013 12:01 pm

Here is my code but I receive an error message: " database not found" tables.edb does not exist.


wfcreate(wf=tables, page=table) u 1000
wfsave tables
close tables.wf1

for %f AUS BRA CAN CHL IND KOR MEX NOR NZL ZAR
wfopen {%f}.wf1
copy bic_{%f} tables::table\bic_{%f}

next

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

Re: A table filled with values from different workfiles

Postby EViews Gareth » Sat Mar 02, 2013 3:19 pm

Don't close the tables workfile.

alps
Posts: 28
Joined: Sun Feb 24, 2013 7:42 am

Re: A table filled with values from different workfiles

Postby alps » Sat Mar 02, 2013 4:01 pm

It worked, thanks a lot! I have another question. Is copytable or copyrange available in version 7? I cannot find the command in Eviews 6 help.
have a great day

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

Re: A table filled with values from different workfiles

Postby EViews Gareth » Sat Mar 02, 2013 4:05 pm

Only in EViews 7 or 8.

alps
Posts: 28
Joined: Sun Feb 24, 2013 7:42 am

copytable command

Postby alps » Sun Mar 03, 2013 9:15 am

hello,
I want to increment the row number in the copytable command as below, but it doesn't seem to be working. I think an exact number is required.
Thanks

table for_all
scalar i=1

for %f AUS BRA CAN CHL IND KOR MEX NOR NZL ZAR
for_{%f}.copytable for_all i 1
i=i+8
next

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

Re: A table filled with values from different workfiles

Postby EViews Gareth » Sun Mar 03, 2013 10:25 am

Try:

Code: Select all

table for_all scalar i=1 for %f AUS BRA CAN CHL IND KOR MEX NOR NZL ZAR for_{%f}.copytable for_all {i} 1 i=i+8 next

alps
Posts: 28
Joined: Sun Feb 24, 2013 7:42 am

Re: A table filled with values from different workfiles

Postby alps » Sun Mar 03, 2013 10:40 am

thanks a lot. It worked.

kaneeme
Posts: 1
Joined: Wed Feb 25, 2015 1:34 am

Re: A table filled with values from different workfiles

Postby kaneeme » Wed Feb 25, 2015 1:39 am

Hi there!
May I please ask for your help. I tried replicating the code below to merge several tables in a single table in a workfile. however, it is giving me an error: "Result_arm is not defined in "do_result_arm.copytable for_all 1 1". I used the code:

table for_all
scalar i=1

for %f arm aze ban geo
result_{%f}.copytable for_all {i} 1
i=i+4
next

Each table is 3x3.
I dunno how to resolve this issue.

thanks


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest