EXAMPLES (TMS BEGIN command)
TMS BEGIN
/DESTINATION OUTFILE='/mydir/mytransformations.xml'.
COMPUTE modelvar=ln(var).
TMS END.
-
TMS BEGIN
marks the beginning of a block of transformation commands that will be evaluated for export to PMML. - The variable var is transformed with a log function to create the variable modelvar, which is to be used in a model. The details of this transformation will be included as PMML in the file /mydir/mytransformations.xml.
-
TMS END
marks the end of the block and causes the output file to be written, but has no effect on the state of the transformations contained in the block. In the present example, the transformation to create modelvar is still pending after the completion of the block.
Tolerated Commands in a TMS Block
TMS BEGIN
/DESTINATION OUTFILE='/mydir/mytransformations.xml'.
STRING new_strvar (A1).
RECODE strvar ('A','B','C'='A') ('D','E','F'='B') (ELSE=' ')
INTO new_strvar.
TMS END.
- The
STRING
command is used to create a new string variable that is to be the target of a recode transformation of an existing string variable.STRING
is a tolerated command so it is executed in the normal manner, without generating an error or implicitly ending theTMS
block.
Commands that Cause an Implicit TMS END
TMS BEGIN
/DESTINATION OUTFILE='/mydir/mytransformations.xml'.
RECODE numvar1 (0=1) (1=0) (ELSE=SYSMIS) INTO new_numvar1.
FREQUENCIES new_numvar1.
RECODE numvar2 (1 THRU 5=1)(6 THRU 10=2)(11 THRU HI=3)(ELSE=0)
INTO new_numvar2.
TMS END.
- The
FREQUENCIES
command causes an implicit end to theTMS
block, causing the output PMML file to be written. The output file only contains the recode transformation for numvar1--that is, the transformations prior to the command causing the implicitTMS END
. - Although the
FREQUENCIES
command implicitly ends the block, the recode transformation for numvar2 is processed in the normal manner and remains pending until the next command that reads the active dataset. - Although we have included it in this example, the
TMS END
command is not needed when there is a command that implicitly ends theTMS
block. In this example, execution of theTMS END
command generates a warning indicating that there is no currentTMS
command in effect.
Using EXECUTE in a TMS Block
TMS BEGIN
/DESTINATION OUTFILE='/mydir/mytransformations.xml'.
RECODE numvar1 (0=1) (1=0) (ELSE=SYSMIS) INTO new_numvar1.
RECODE numvar2 (1 THRU 5=1)(6 THRU 10=2)(11 THRU HI=3)(ELSE=0)
INTO new_numvar2.
EXECUTE.
- You can include
EXECUTE
in aTMS
block. In its usual manner, it will cause all pending transformations to be executed. In addition, it causes an implicit end to the block which then causes the output PMML file to be written. - In the current example, we have omitted the
TMS END
command since the block is implicitly ended by theEXECUTE
command.