Manipulating tables from other runs
Quick reference
To manipulate tables in a different run, type:
Rrun_id / table_manip_expression
or:
Rrun_id>table_manip_expression
More information
To manipulate tables from previous runs, the numbers in those tables need to be saved somewhere. Quantum does this automatically whenever a run produces tables. Although you need not worry about saving tables, it is nevertheless necessary to understand a little of this mechanism in order to manipulate your tables correctly.
In a run containing no manipulation at all, Quantum saves the cell values of each table in a numbers file. You cannot read this file yourself so think of it as a list of numbers separated by spaces or commas, where the first number belongs in the first cell of the first table, the second number belongs in the second column of the first row of that table, and so on.
Now, when a run contains manipulation statements, all ordinary tables are saved in the numbers file as usual, while both manipulated and unmanipulated figures are saved in the manipulated numbers file. Again, you cannot read this file so just think of it as a list of numbers and spaces.
Tables from anywhere in previous runs can be manipulated by preceding the table specification with the letter R, a run ID of up to six characters and a slash (/). For example, to multiply the second table in a run called JAN by two, write:
tab a1 b1
ex RJAN/T#2 * 2
To use run IDs, you must create a run definitions file in the same place as your Quantum program. Each line in this file must contain the run ID and the location of the run it represents, separated by a space. For more information about creating this file, see
Run definitions file.
Sometimes the numbers from previous runs might themselves be the result of some manipulation, but unless you say otherwise, Quantum assumes that you are using unmanipulated figures and searches for the named table in the ordinary numbers file.
To force it to read manipulated figures from the manipulated numbers file follow the run location name in the definitions file with a space and the word manip. If the run definitions file names regA as the location of the numbers file for Region A and regB as the locations of the manipulated numbers file for Region B, write:
tab age sex
ex + RregA/t@ + RregB/t@
This might create a table showing age by sex for people interviewed in regions A, B and C (the region you are currently analyzing):
Region A (not printed)
| Base | Male | Female |
Base | 70 | 30 | 40 |
18-24 | 25 | 10 | 15 |
25-40 | 32 | 12 | 20 |
41-60 | 13 | 8 | 5 |
Region C (not printed)
| Base | Male | Female |
Base | 60 | 28 | 32 |
18-24 | 22 | 12 | 10 |
25-40 | 27 | 12 | 15 |
41-60 | 11 | 4 | 7 |
Region B (not printed)
| Base | Male | Female |
Base | 85 | 50 | 35 |
18-24 | 30 | 21 | 9 |
25-40 | 29 | 17 | 12 |
41-60 | 26 | 12 | 14 |
| | | |
Regions A, B and C
| Base | Male | Female |
Base | 215 | 108 | 107 |
18-24 | 77 | 43 | 34 |
25-40 | 88 | 41 | 47 |
41-60 | 50 | 24 | 26 |
Note When referring to tables in other runs, make sure that you name the right table: the notation T@ meaning the current table should only be used for the other runs if the table being called up is in the same relative position in the run as the table created by the current tab statement. If you are on the fifth table, T@ will mean the fifth table in all other runs as well.
See also