Example of how to that uses the CLEANER block to modify tables
Attached is a spec TABLEMANIPULATION.SPX that shows how to use the ~Cleaner block to modify tables in order to create an weighted average percentage column.
The first part of the run is just creating the normal tables. The important lines are those in the CLEANER block. The lines after it are to print the tables. This setup is beneficial because it will work regardless how many tables you have, you only need to set the repeat variable so that it repeats all the applicable tables and all the tables will be affected no matter how many rows each table has.
Whenever you are doing LOTS of table manipulation be sure to use both an unload_tables ! command after you have stored the table you are working on and to use the set options tabledropmode=1. These may cause some runs to be a little bit slower as they cause tables to be removed from memory, but this does free up that memory to be used for subsequent tables.
>purgesame~in tablemanipulation.DAT,ascii=40~set droplocaledit tabledropmode=1~specfile tablemanipulation>createdb tablemanipulation,dup=warn>printfile tablemanipulation~def stub= stubtop:[fdec=0] total[suppress] noanswer }tabset= global:edit=: cwid=8 swid=30 -vper -col_tna stub_pref=stubtop fdec=1 }banner=: