Tables and axes > Creating tables > Combining tables > Adding tables
 
Adding tables
Quick reference
To add tables, type a tab statement for the first table and follow it with:
add[row_offset[,col_offset] ] axis_names
where axis_names is the same number of axis names as appears on the tab statement.
More information
Another way of combining tables is to add them together. Quantum can add tables by placing them one on top of the other and adding the corresponding cells in each table, or by offsetting them so that, for example, the cells in row 1 of the first table are added to those in row 3 of the second.
The easiest way of adding two tables is to add all cells in the first row of the first table to the corresponding cells in the first row of the second table, and so on. All that’s needed is a tab statement to create the first table followed by an add statement generating the second, for example:
tab ax01 bk01
add ax02 bk02
This example creates the table ax02 by bk02 and adding it to the table ax01 by bk01.
A practical example might be an office equipment survey in which a set of 3-column fields store the number of different makes of typewriter that each company owns. If the first ten fields refer to manual typewriters and the next ten refer to electric typewriters, you might want a table showing the total number of typewriters of each brand owned.
If you write:
tab manbrd comsiz;c=c(123,149)u$ $
add elecbrd comsiz;c=c(151,175)u$ $
l manbrd
n10Base
n01Brand A;inc=c(123,125)
n01Brand B;inc=c(126,128)
        .
l elecbrd
n10Base
n01Brand A;inc=c(151,153)
n01Brand B;inc=c(154,156)
        .
the row for Brand A indicates how many Brand A manual and electric typewriters each company owns. This example uses inc= to count the number of typewriters rather than using c= to note the presence or absence of typewriters.
Note In this example, all of the figures are added together, including the base row. This can result in misleading base figures. You can avoid this situation either by using a dummy base row in the second table, or by removing the base row from the second table and using the add with offset feature, as described below.
See
Offsets with added tables
Dummy elements with offset tables
See also
Combining tables