Advanced tables and statistics > Row and table manipulation > Manipulating whole tables > Referring to tables in the current run
 
Referring to tables in the current run
Quick reference
To refer to tables in the current run, type one of:
Tquantum_table_number
Tid_name
T#absolute_position
T@relative_position
More information
As with individual rows, a table can be referred to in several ways. The first is to use the ID which is assigned automatically by Quantum: the first table in the run is 1, the second is 2, and so on. These numbers are printed to the right of each table-creating statement in the compilation listing. For example, the first table would be numbered:
tab ax01 bk01                  000001
and to use it on an ex statement, write:
tab ax01 bk01
ex t000001 * 10
This produces a table in which each cell is ten times its original value. When automatic IDs are used, they must be preceded by the letter T in upper or lower case, as shown in the example. The leading zeros in the table ID number are optional; it could have been written as ex t1 * 10.
Alternatively, you can make up your own identifiers using the id= option on the tab statement. This is a code of up to six numbers and/or letters starting with a letter, for example:
tab ax01 bk01;id=first
ex Tfirst * 10
The automatic identifier is generated for each tab statement and each axis on an and statement, but not for add, div, sid and und statements. Also, when an id= appears on a tab statement, it interrupts the automatic count so that the next table without a user-specified ID will carry on where the last one left off:
tab age sex        000001
tab demog bk01;id=demog
tab region class    000002
Note Avoid using use IDs of the form Tn (for example, T15, T29) as these can be confused with Quantum’s automatic IDs.
The second method is to refer to the table’s absolute position in the run, preceded by the characters T# (the T must be upper case). This is found by starting at the first tab statement and counting down until the required table is reached — all tab, ex, add, sid, und and div statements count as one table, while ands cause the count to be incremented by the number of axes they contain. For example, to refer to the third table, use:
ex T#3 / 10
Here the cells in the new table are created by dividing the numbers in the third table by 10. All tables mentioned in this manner must come before the current table; you can not manipulate table 12 when you are only on table 8.
Tables can be called up according to their relative positions in the run, preceded by the characters T@. As with rows, the relative position is calculated by counting backwards from the ex statement to the appropriate tab statement. T@ and T@0 both mean the current table; that is, the table created by the tab immediately before the ex statement.
If you had:
tab ax01 bk01
tab ax02 bk02
ex exp(T#1,2) / T@0)
you would have two tables: the first which was the table ‘ax01 by bk01’ and the second which is the first table squared and divided by the table ‘ax02 by bk02’.
See also
Manipulating whole tables