Using Predefined Velocity Variables

Predefined Velocity Variables

Here are the predefined Velocity variables:
Variable
Description
$SASLIBRARY
The name of the library that contains the input data source. The $SASLIBRARY variable is defined only if you have a DataSource element in the task.
$SASTABLE
The table name of the input data source. The $SASTABLE variable is defined only if you have a DataSource element in the task.
$sasOS
The operating system for the SAS server.
$sasVersion
The version of the SAS server.
$MathTool
The Java object for the Apache Velocity MathTool. For more information, see Floating Point Math.
$CTMUtil
This tool holds a Java object that provides common utility methods for the common task models. For more information, see Common Utilities for CTM Writers.

Floating Point Math

Using the MathTool from Apache Velocity, mathematical expressions can be evaluated in the Velocity context. For example, you can convert a double value to an integer by using the intValue() method. For more information, see the MathTool Reference Documentation at http://velocity.apache.org.
This example shows how to use mathematical expressions in the Velocity template. $PCT contains a value between 1 and 100.
<Options>
   <Options name="PCT" defaultValue="10" inputType="inputtext">Value used 
      in the equation</Option>
</Options>
<CodeTemplate>
   <![CDATA[
#if ($PCT)
#set ($OUTCALC = 1 - ($MathRool.toDouble($PCT)/100))
$MathTool.roundTo(2, $OUTCALC)
$MathTool.toDouble($PCT).intValue()
#end
]]>
</CodeTemplate>