Tables and axes > Creating tables > Combining tables > Dividing one table by another
 
Dividing one table by another
Quick reference
To divide one table by another, define the top table on a tab statement followed by:
div axis_names [;options]
where axis_names is a list of as many axis names as there are on the tab statement, and options is any of the keywords anlev=, c=, inc=, maxim, means, median, minim or wm=.
More information
When tables are divided, the table on the tab statement is always the numerator (table to be divided) and the table on the div statement is the denominator (table by which to divide). Both tables must have the same number of rows and columns since the final table is achieved by placing tables on top of one another and dividing the corresponding cells. If the division for a cell has a remainder, the result is rounded up to the next highest whole number. Where a cell in the second table is zero, the corresponding value in the first table remains unchanged; for example, 4/0 gives a value of 4.
Only one div statement may follow a tab. Any more are ignored.
The format of the div statement is:
div axis1 axis2 ... [axis6];[options]
where options are any of the keywords:
anlev=
c=
inc=
maxim
means
median
minim
wm=
Output options such as the number of decimal places for absolutes, or the amount of spacing between lines in the output are taken from the tab, flt, sectbeg or a statement in that order. For a list of output options, see Options on a, sectbeg, flt and tab statements.
The statements:
tab ax06 loaf;inc=c(132,133);dec=2
div ax06 loaf
produce a table showing the number of loaves bought per person. The tab table creates a table containing the total number of loaves bought whereas the div table contains the number of people buying bread. The axes are the same; the difference is inc= on the tab line. Dividing the first by the second to get the average number of loaves bought per person.
See also
Combining tables