SPSS CLEM is the control Language for Expression Manipulation, which is used to build expressions within SPSS Modeler streams. CLEM is actually used in a number of SPSS “nodes” (among these are the Select and Derive nodes) and you can check the product documentation to see the extended list.
CLEM expressions are constructed from:
- Values,
- Fields,
- Operators (arithmetic, relational, logical operators) and
- Functions
Scripting?
CLEM should not be confused with the scripting capability that both SPSS Statistics and SPSS Modeler offer (known as Syntax). Syntax scripting is more of an automation tool, while CLEM’s purpose is focused on specific data manipulations, however a subset of the CLEM language can be used when scripting in the user interface – supporting many of the same data manipulations in an automated fashion.
With “CLEM”, you have the power to (using expressions) do many things, such as:
- Compare and evaluate conditions on record fields.
- Derive values for new fields.
- Derive new values for existing fields.
- Reason about the sequence of records.
- Insert data from records into reports
Using CLEM
In nodes like “Select” and “Derive”, expressions and conditions can be entered directly (by typing them in) or by using the SPSS Expression Builder. The Expression Builder is invoked by clicking the Launch expression builder button in the respective dialog (for example, in a Select node you click the Launch expression builder button to launch the Expression builder).
The Expression Builder provides a powerful tool to construct expressions and in addition, the Expression Builder can check the validity of your expression in real-time.
More on the Expression Builder
- Across the top of the Expression Builder dialog is where you can enter your expression directly (or where the generated expression ends up).
- “General Functions” list all available SPSS functions available to the expression builder.
- The middle of the dialog shows the expression operators for selection.
- Under “Fields” you can view and select a field (from your data) to be used in the expression.
- When you click on a function, its description is displayed under the Function list.
- You can use the “Check” button to test the syntax of your expression.
- A value can be picked from a list of values (provided the field has been instantiated) by clicking the fields Value button or right clicking on the field itself.
Scripting and Expressions in Cognos TM1
In Cognos TM1, the closest thing to the SPSS expression builder is its rules editor. Which started out “pretty rudimentary” in form:
In more recent versions, TM1 introduced the “advanced rules editor” (remember, you have to set the TM1p.ini AdvancedRulesEditor = T setting to access this editor) with its specific tools to help you create, manage, and verify TM1 rules. This Rules Editor has a full set of menus for creating, editing, and managing rules. Keyboard shortcuts are provided for the more commonly used menu options.
The advanced version of TM1’s rule editor is similar to the SPSS Expression builder in that it allows the developer to either enter the express (the rule) directly (type it in) or “build it” from dialog selections such as the Insert Function button (which then displays the Insert Function dialog allowing you to select a function and even the function parameters from succeeding dialogs):
Conclusion
If you are a TM1 developer and have written your share of TM1 rules, you will feel comfortable with the concept of using CLEM and the expression builder with in SPSS Modeler.