Overview (TMS BEGIN command)

The TMS BEGIN command indicates the beginning of a block of transformations to be exported to a file in PMML format--specifically, PMML 3.1 with IBM® SPSS® Statistics extensions. The exported transformations can be merged (using TMS MERGE) with a PMML model file in order to include any transformations of the raw data required to create the variables used in the model. The merged PMML file can be used to score data with scoring functions. (For more information on scoring functions, see Scoring expressions.) When you score data with a model file containing transformations, the transformations will be applied to the data before scoring. The transformations are carried out as part of the internal scoring process and have no effect on the active dataset. The TMS END command is used to end the block.

From the point of view of the active dataset, transformations in a TMS BEGIN-TMS END block are no different than transformations outside a TMS block--they are pending and will be executed with the next command that reads the active dataset. Source variables used in transformation expressions in TMS blocks must exist in the active dataset. In a typical scenario, you would run TMS BEGIN-TMS END command syntax on the raw dataset used to build the associated model, assuming it contains the source variables used in any transformation expressions.

Commands within a TMS block are categorized as belonging to one of four types: exported, tolerated, invalid, and those causing an implicit TMS END.

Exported. These are commands that produce export to PMML. Commands in this category include the supported transformations--for example, RECODE. Many transformations are expressed with functions included on a COMPUTE command. Export to PMML is supported for a limited set of such functions. The set of commands that produce export to PMML, as well as the set of supported functions, are provided at the end of this topic.

Tolerated. These are commands that can be included in a TMS BEGIN-TMS END block, are executed in normal fashion, but do not produce export to PMML. Examples include NUMERIC, STRING, USE, INCLUDE, and INSERT. In the case of INCLUDE or INSERT, supported transformations from the inserted file will be exported to PMML.

Invalid. These are commands that cannot be processed within a TMS block and will give rise to an error. The list of invalid commands is provided at the end of this topic.

Implicit TMS END. These commands are executed in normal fashion but cause an implicit end to the current block, which then causes the output PMML file to be written. Transformations (in the current block) occurring after one of these commands are not exported to the output PMML file. Commands in this category include all of the statistical procedures--for example, ANOVA and REGRESSION--as well as the EXECUTE command. ADD FILES, MATCH FILES and COMPARE DATASETS belong to this category as well as any command that causes a different dataset to become active--for example, DATASET ACTIVATE, GET, and GET DATA.

Basic Specification

The basic specification for TMS BEGIN is the command name followed by a DESTINATION subcommand that contains an OUTFILE specification.

Syntax Rules

  • The DESTINATION subcommand is required.
  • An error occurs if the DESTINATION subcommand is specified more than once.
  • An error occurs if the OUTFILE keyword is specified more than once.
  • Equal signs (=) shown in the syntax chart are required.
  • Subcommand names and keywords must be spelled in full.

Operations

  • Once a TMS BEGIN command is executed, it remains in effect until the end of the session, until explicitly ended by a TMS END command, or until a command that implicitly ends a TMS block--for example, any statistical procedure--is encountered.
  • TMS commands (for example, TMS MERGE) are not allowed within a TMS block.
  • TMS BEGIN verifies that the path specified for the destination file is valid. If the path is invalid, the commands in the block will be processed in the normal manner but no PMML will be exported.
  • The following conditions will cause the destination file to be written: a command that causes an implicit end of the block is executed; the TMS block ends explicitly with TMS END; the current session ends before the block ends (either explicitly or implicitly). The destination file is unavailable to other commands until after it is written. TMS END has no effect if the block is ended implicitly.
  • An error occurs if a transformation in the block is not supported. The command containing the invalid transformation is not executed. This type of error does not cause an implicit end to the TMS block and has no effect on when the destination file is written.
  • The order of the transformations in the destination file may not be the order in which they were specified in the TMS block.
  • Transformations specified in a TMS block are processed in the normal manner--that is, pending and to be executed with the next command that reads the active dataset.

Exported Commands

The following commands produce export to PMML: ADD VALUE LABELS, COMPUTE, DO REPEAT, MISSING VALUES, RECODE, VALUE LABELS, VARIABLE LABELS, VARIABLE LEVEL.

  • For COMPUTE, the target variable must be a variable that has not already been assigned a value or otherwise used in the associated TMS block. For example, the following is invalid:

    COMPUTE var = var + 1.

  • For RECODE, all input and output keywords are supported except CONVERT. In addition, you must always recode INTO a variable that has not already been assigned a value or otherwise used in the associated TMS block. When a recoding transformation is carried out on a dataset to be scored, the results depend on whether the target variable exists in the dataset. If the target variable already exists, cases with values (of the source variable) not mentioned in the value specifications for the recode are not changed. If the target variable does not already exist, cases with values not mentioned are assigned the system-missing value.

Invalid Commands

The following commands are invalid inside a TMS block: AGGREGATE, BREAK, COUNT, DO IF - END IF, ELSE, ELSE IF, END CASE, END FILE, FILE TYPE - END FILE TYPE, FILTER, IF INPUT PROGRAM - END INPUT PROGRAM, KEYED DATA LIST, LEAVE, LOOP - END LOOP, N OF CASES, POINT, RECORD TYPE, REPEATING DATA, REREAD, SAMPLE, SELECT IF, VECTOR, WEIGHT, WRITE.

The following functions, operations, and system variables are supported for use with the COMPUTE command in TMS blocks. In a few cases--for example, CHAR.SUBSTR--multiple forms (differing in the number of parameters) exist, but only a single form is supported. The parameters available in the supported form are:

  • + Addition
  • - Subtraction
  • * Multiplication
  • / Division
  • ** Exponentiation
  • & Logical AND
  • | Logical OR
  • ~ Logical NOT
  • = Equal to
  • ~= Not equal to
  • < Less than
  • > Greater than <= Less than or equal to
  • >= Greater than or equal to
  • ABS
  • CDF.NORMAL
  • CDFNORM
  • CHAR.CONCAT
  • CHAR.LENGTH
  • CHAR.SUBSTR(strexpr,pos)
  • CONCAT
  • EXP
  • IDF.NORMAL
  • LG10
  • LENGTH
  • LN
  • LOWER
  • LTRIM(strexpr)
  • MAX
  • MEAN
  • MIN
  • MOD
  • PDF.NORMAL
  • RND
  • RTRIM(strexpr)
  • SD
  • SQRT
  • SUBSTR(strexpr,pos)
  • SUM
  • SYSMIS
  • TRUNC
  • UPCASE
  • VALUE
  • VARIANCE

Notes

  • Within a TMS block it is recommended to use CHAR.CONCAT, CHAR.LENGTH, and CHAR.SUBSTR in place of CONCAT, LENGTH, and SUBSTR.
  • String arguments for the MAX and MIN functions are not supported for scoring.