1. Home
  2. TABINSERT procedure

TABINSERT procedure

Inserts the contents of a sub-table into a table (R.W. Payne).

Options

OLDTABLE = tables Table containing the original values
SUBTABLE = tables Sub-table to insert into the original table
NEWTABLE = tables Tables to store the new values; if this is not set, these replace those in the original table

Parameters

OLDFACTOR = factors Factors classifying the dimensions of the old table that are smaller in the sub-table
SUBFACTOR = factors Specifies the factors classifying the corresponding dimensions of the sub-table
FREPRESENTATION = string token How to match the values of each OLDFACTOR and SUBFACTOR (levels, labels); default leve

Description

TABINSERT allows you to replace values in a table by those in a sub-table. It can also be used to insert values into the margins of a table. The original table and the sub-table are specified by the OLDTABLE and SUBTABLE options, respectively. You can use the NEWTABLE option to a specify a table to store the modified table values. If this is not set, they replace those in the original table.

The sub-table will usually have the same number of classifying factors as the original table. Some may be in common (and these can be ignored). Pairs of factors that differ are specified by the OLDFACTOR and SUBFACTOR parameters. The FREPRESENTATION indicates whether the factors are to be matched by their levels (default) or their labels. The idea is that the levels (or labels) of the SUBFACTOR are a subset of those of the OLDFACTOR, indicating where the values of the sub-table are to be inserted. If you omit some factors of the original table from both the sub-table and the OLDFACTOR list, the values of the sub-table are inserted into their margins in the modified table.

If both tables have margins, those in the sub-table will be transferred as well as those in the body of the table. If you want to omit the marginal values, you should remove the margins from the sub-table, using the MARGIN directive with parameter METHOD=deletion. You can also use MARGIN to recalculate the margins in the new table, if they are no longer valid after the values in the sub-table have been inserted.

Options: OLDTABLE, SUBTABLE, NEWTABLE.

Parameters: OLDFACTOR, SUBFACTOR, FREPRESENTATION.

Method

TABINSERT uses COMBINE to determine where the cells of the sub-table occur in the original table.

See also

Directives: COMBINE, TABLE, TABULATE.

Procedures: TABMODE, TABSORT, T%CONTROL.

Commands for: Calculations and manipulation.

Example

CAPTION   'TABINSERT example'; STYLE=meta
FACTOR    [LABELS=!t(a,b,c,d)] F1
FACTOR    [LEVELS=6] F2
TABLE     [CLASSIFICATION=F1,F2; VALUES=1...24] T
FACTOR    [LABELS=!t(b,c)] B1
FACTOR    [LEVELS=!(2,4,5)] B2
TABLE     [CLASSIFICATION=B1,B2; VALUES=101...106] S
" insert values into a subset of the levels of F1 & F2 "
TABINSERT [OLDTABLE=T; SUBTABLE=S; NEWTABLE=N] F1,F2; SUBFACTOR=B1,B2;\
          FREPRESENTATION=labels,levels
PRINT     T,S,N; FIELD=8; DECIMALS=0
" insert values into the F2 margin "
TABLE     [CLASSIFICATION=F1; MARGIN=yes; VALUES=1...5] SM
TABINSERT [OLDTABLE=T; SUBTABLE=SM; NEWTABLE=N]
PRINT     T,SM,N; FIELD=8; DECIMALS=0
Updated on June 18, 2019

Was this article helpful?