Coding new variables in a dataset

Creating a Logical Variable

Updated over a week ago

You can create a new logical variable and save it in a codebook for subsequent analyses on an ongoing basis. For example, you can create a set of demographic categories to analyse target audiences, etc.

To create a logical variable, open the database and click Project settings (cog) icon to open the Meta-Editor.

  • In the Meta-Editor, click the 'snowman' icon;

  • Pick 'Create Logical variable' from the dropdown list;

    Create a logical variable

  • In the pop-up window enter a variable name, then click OK.

  • Find the new variable in the codebook and select it - it will usually be placed at the bottom of the list. Then, click the ‘Edit’ icon to open the Logical Expression Builder (LEB) window;

    Edit a logical variable

  • In the Logical Expression Builder, the codebook is displayed on the left-hand panel. Drag&drop codes onto the ‘Categories’ panel to build the logical variable, combining them with the appropriate logical operators.

For example, to create the audience of ‘Women age 40+’, you should OR-join the age categories of 40-49 and 50+, then drop ‘female’ onto this and select AND-join. 
  • Changes are saved automatically.

Expression Builder window

You can also build codes (logical expressions) directly in crosstab, although these are not saved permanently within the codebook like logical variables.

Did this answer your question?