Advanced tables and statistics > Row and table manipulation > Manipulating parts of tables
 
Manipulating parts of tables
Quick reference
To manipulate part of a table, type:
ex element_ref = expression
after the tab statement for that table. Side elements are referred to as sid and banner (column) elements are referred to as bid. In both cases, id is the row number or identifier.
References to elements in other tables must start with the table reference followed by either / or >.
More information
New tables can also be created on an element by element basis using rows and columns from tables created previously in the same or different runs. Statistical and totalling elements can not be manipulated.
You can create a table and replace all the numbers in that table with numbers from other tables. Manipulation is not an alternative to the tab statement: manipulation deals only with numbers whereas a tab statement takes texts as well and formats them to produce row and column headings.
To create a table using elements from other tables, use the statements:
tab rows columns
ex element=expression
The tab statement defines the basic table to be modified, element names the row or column to be created in the current table and expression is an expression defining the manipulation required.
Elements are entered as sn for side (row) elements and bn for breakdown (column) elements, where n is the absolute position of the new element in the table. For example, the first row is s1 and the first column is b1. When calculating an element’s position in a table, remember that each n statement, other than n00, counts as one element.
If the elements to be manipulated have IDs you can use these instead; for example, spr1 for the side element whose ID is pr1.
The expression is made up of operators and operands. Operators and operands allowed are any of those used for row and table manipulation, or references to elements in the current table or in any previously created table. Elements in expressions are entered as sn, sid, bn or bid. If they are not part of the current table, the element specifications must be preceded by the table reference and a / or > sign.
For example:
tab aa bb
ex s1=s1 + T#2/s2
creates the table aa by bb and then adds the figures in the second row of the second table in the run to row 1 of aa by bb. Note that the expression could also have been written as ex s1+T#2>s2.
This form of ex statement must refer either to complete tables or to side elements or to breakdown elements; a combination in one statement is not allowed. To perform manipulations using a variety of elements, write a separate ex statement for each type. There is no limit to the number of ex statements which can follow a tab.
The statements:
tab ax01 bk01
ex s3=s1 + s2
ex b1=b1 * 10
create the table ax01 by bk01 and then replace the counts in the third row with counts which are the sum of first and second rows. Then, the values in the first column are multiplied by 10. Here are use some numbers to clarify this:
ax01 by bk01 (not printed)
           
First   
Second  
Third   
Row A
10
4
15
Row B
8
13
9
Row C
11
7
11
Manipulated output
           
First   
Second  
Third   
41
100
4
15
27
80
13
9
Row C
180
17
24
See also
Row and table manipulation