MT (manip table)

<< Click to Display Table of Contents >>

Navigation:  Reference > Commands >

MT (manip table)

MT commands are used to alter the contents of tables.

IMPORTANT: MT commands should normally only be used in manip stages. They will be accepted in tables stages but be aware they will be executed again for every record.

MT commands are normally used with tables which have already been incremented and therefore are almost always used in separate Manip Stages.

The value(s) specified on the right hand side of the command are placed directly into the cells of the tables overwriting their previous contents.

Tables defined by a MT (manip table) command may be new (not previously defined) tables, in which case they take their size from the first table (or part table) encountered in their definition, except as noted below.

Tables defined for the first time by a MT (manip table) command must be defined in full - a part-id may not appear on the left hand side of the definition.

IMPORTANT: you are advised not to create new tables to be printed with MT (manip table), use a dummy (F=NITB) T (tabulate) command instead.

MT commands may also be table redefinitions, in which case the table defined must have the same number of cells as in the first definition and be of the same table type, distribution or statistics, as in the first definition.

The presence of the "+" before MT indicates that this is a suppress heading table (that it is to be printed immediately below the previous one with no titles or banner labels). This has the same affect as setting F=CON. An error occurs at print time if the number of columns is not equal to the number of columns in the previous table. Absence of the "+" on the first definition means that the table is to be printed with the table title, banner labels and other standard options that may have been requested.

There are various forms of the MT command, as follows:

Table arithmetic manipulations

MT table [(part-id)] [(F= ...)] = table arithmetic,

The values for table arithmetic are computed, and the result stored in the table.

All the tables referenced in the table arithmetic must have been previously defined, and they must be of the same type (distribution/statistics) as the defined table.

The number of cells referenced in table arithmetic must be the same as in the table part-id being defined, or the whole table if no part-id is defined. If this is the first definition of the table, the number of cells in table arithmetic define its size.

Arithmetic is carried out on a cell-by-cell basis.

If a variable or a constant is referred to in the table arithmetic, it is treated as if it were a table of appropriate size, with all of the cells set to the value of the constant or variable.

If a division operation involves division by zero, a warning message is written to the screen and to the Report file, and the cell is set to undefined.

Examples of MT table arithmetic commands:

mt #a = 0.0,

mt #56(r2,c4)=$wval*100.0,

mt #67 = #67sum / #67num,

mt #dum(r1-5) = #41(r1-5) + (r6-10),

mt #1a(c4)=#1a(c3)/(c2)*100.0,

mt #1(c3,r1-$)=#(c4,r1-$)/2.0,

Function manipulations

See also the chapter on functions.

MT table [(part-id)] [(F= ...)] = function,

The value(s) of the function are evaluated and the result stored in the table.

Some functions set a single cell of a table, some set several or all of the cells. If the table is a new table, its size will be determined by the type of function.

Examples of MT function commands:

mt #1s=%sqrt(#1),

mt #100(c10,r2-30) = %rnk(#200(c10,r2-30)),

mt #2=%tex(79.9999,9999999.9,'over 80'),

mt#4a(c3,r1-$)=%tval(0.00001,9999999.9,1.0),

Table of constants

MT table [(part-id)] [(F= ...)] =(wconstant , wconstant ... ),

This command assigns values to a table on a cell-by-cell basis. The order of specification of the values is: row 0 columns 0-end, row 1 columns 0-end, row 2 columns 0-end and so on.

This command is most commonly used to define a set of targets for target weighting. The table defined is divided by an incremented table of actuals to produce a table of factors, which can be picked from the table.

If the table is a new table, then it will have a total column only, and as many rows as values.

Examples of MT table of constants commands:

mt #targets(r1-$,c1-$) = (101.34, 91.56, 80.11, 32.67,

200.43, 21.59), 

mt #1(r$)=(5.0,1.0,3.0,0.0,0.0,1.0),

Character table manipulation

MT table [(cell)] = cvar,

This command puts a character string into a table cell. Note that the cvar must not be longer than 8 characters.

IMPORTANT: this facility is provided only to enable table look up; you should not attempt to print or list a table containing character values, or to increment or manipulate it in any way.

To insert printable text into a table, see %TEX function in the chapter on functions.

Examples of MT character manipulation commands:

mt #lookup(c1,r3)=cfill,

mt #find(e$icnt)=ctext,