Edit Variable Definition dialog box
You use the Variable Definition dialog box to define the formula that is to be used to derive the 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 will have the same base as that other variable. If you leave the definition blank, UNICOM Intelligence Reporter - Survey Tabulation will automatically use an expression of {}, which means that all respondents will be included in the base for the variable.
Note This is an advanced feature and generally it is only necessary to manually define the formula for the derived variable when you create a new variable using the New Advanced option. When you create a new variable using the Copy and Merge commands, UNICOM Intelligence Reporter - Survey Tabulation automatically creates the formula for you. However, advanced users may sometimes want to amend the generated formula.
How you specify variables in the expression depends on whether you are using the hierarchical or flat view of the data:
▪When the flat view is used, you should always specify variables using their
full names. For most variables, the full name is the same as the name. However, the full name is different when the variable is nested inside a block, grid, or loop. You can easily the show the full names in the Variable List. See
Changing the columns in the Variable List for more information.
▪When the hierarchical view is used, the
level of the new variable and the expression is defined by the position of the new variable in the Variable List. You should 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
Filtering hierarchical data for more information.
To open the Edit Variable Definition dialog box
Click
Variable Definition in the top right corner of the New Variable dialog box (see
New Variable dialog box).
Tips
Derived variables
Do not include any derived variables in the expression, otherwise you will get an error when you attempt to populate a table that includes the new variable.
Copying an existing variable
To copy of another variable, type its name in the text box. For example, if you want the new variable to be a copy of the age variable, type age in the text box.
When making a copy of another variable, make sure that the new variable has the same data type as the variable you are copying (the one whose name you type in this text box). When creating a new categorical variable by copying an existing categorical variable, the new categorical variable automatically has the same categories as the variable you are copying.
Merging categorical variables
If you want to merge two or more categorical variables, for example, because you want to create a total awareness categorical variable, enter the names of the variables you want to merge separated by the + operator. For example, if you want to create a total awareness variable from variables called Favorite, Spontaneous, and Prompted, type Favorite + Spontaneous + Prompted into the text box. The new categorical variable will automatically have the same categories as the variables you are combining. If the same category appears in more than one of the variables, it will only appear once in the new variable.
Numeric variables
If you are creating a new numeric variable and want to base it on a formula that uses one or more existing numeric variables, type the formula into the text box using the names of the existing variables. For example, in the Museum sample the visits and visits12 variables are both numeric. You could base a new numeric variable on the following expression:
visits12 / visits * 100
Boolean variables
If you are creating a new Boolean variable for use as a filter, enter the expression for the variable. For example, the following expression would select respondents who are male:
Gender = {Male}
Text variables
Sometimes you may want to concatenate two or more text variables, but separate the two texts with a specific text. The following expression would separate the name and address texts with a colon and a space:
name + ": " + address
Expressions and functions
You can use any expression that is supported by the Data Model, including using the functions in the UNICOM Intelligence Function Library. See
Advanced expressions for more information.
See also