Page 1 of 1
A table filled with values from different workfiles
Posted: Sat Mar 02, 2013 9:51 am
by alps
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
Re: A table filled with values from different workfiles
Posted: Sat Mar 02, 2013 10:20 am
by EViews Gareth
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.
Re: A table filled with values from different workfiles
Posted: Sat Mar 02, 2013 11:42 am
by alps
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
Re: A table filled with values from different workfiles
Posted: Sat Mar 02, 2013 12:01 pm
by alps
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
Re: A table filled with values from different workfiles
Posted: Sat Mar 02, 2013 3:19 pm
by EViews Gareth
Don't close the tables workfile.
Re: A table filled with values from different workfiles
Posted: Sat Mar 02, 2013 4:01 pm
by alps
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
Re: A table filled with values from different workfiles
Posted: Sat Mar 02, 2013 4:05 pm
by EViews Gareth
Only in EViews 7 or 8.
copytable command
Posted: Sun Mar 03, 2013 9:15 am
by alps
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
Re: A table filled with values from different workfiles
Posted: Sun Mar 03, 2013 10:25 am
by EViews Gareth
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
Re: A table filled with values from different workfiles
Posted: Sun Mar 03, 2013 10:40 am
by alps
thanks a lot. It worked.
Re: A table filled with values from different workfiles
Posted: Wed Feb 25, 2015 1:39 am
by kaneeme
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