The Create New Variable Based On dialog box is an advanced feature that you can use to define the formula for a new variable. You enter the formula in the form of an expression. This expression also defines the base for the new variable when you use it in a table. For example, if you define the expression as the name of another variable, the new variable has the same base as the other variable. If you leave the definition blank, IBM® SPSS® Data Collection Survey Reporter automatically uses an expression of {}, which means that all respondents are included in the base for the variable.
► To open the Create New Variable Based On dialog box, choose the Select button in the top right corner of the New Variable dialog box.
Existing variables. The left of the dialog box displays all the variables in the current table document (.mtd) file. Double-click a variable from this list or select the variable and choose the >> button to add it to the expression for the new variable.
New variable syntax. Use this area to define the formula for the new variable. You can add variables by dragging and dropping from the Existing variables list, or you can type in the variable names. You can use any expression that is supported by the IBM® SPSS® Data Collection Data Model, including the functions in the IBM SPSS Data Collection Function Library. See the Function List for details of the functions available. See also the Expression Evaluation and IBM SPSS Data Collection Function Library topics in the IBM® SPSS® Data Collection Scripting section of the IBM® SPSS® Data Collection Developer Library for further information.
How you specify variables in the expression depends on whether you are using the hierarchical or flat view of the data:
• When using the flat view, you cannot use any lower level variables or slices of variables.
• When using the hierarchical view, the level of the new variable and the expression is defined by the position of the new variable in the Variable List. Specify the names relative to the level of the new variable. (However, the names of variables inside a block should generally be preceded by the block name followed by a period (.). For example, to specify the Serial variable inside the Respondent block, specify the name as Respondent.Serial.) If you include in the expression any variables from other levels, you need to up-lev or down-lev them to the level of the new variable. See the topic Filtering Hierarchical Data for more information.