A binary variable is a variable that takes only two values, most commonly values of 0 or 1. Binary variables taking values of 0 and 1 are used as Filters and for other general analysis purposes (e.g., representing Pick Any questions. Any 0/1 binary variable can be created as a filter.
This page address binary variables that are created by either:
- Creating a Filter from the Cells on a Table
- Right-clicking on a variable in the Variables and Questions tab and selecting Insert Variable(s) > Binary - Complicated Filter.
Links to other methods for creating Binary Variables are described at the bottom of the page.
Defining a binary variable
Binary variables are defined using Boolean Logic. If the screen shows Undefined Filter Term you need to select one of the variables or questions from the list of Variables and Questions. To add another term, select something in the box at the top-right and press (otherwise, you will over-write anything already created).
Buttons, options and fields
Name The name of the variable to be created.
Label The label of the variable to be created.
Variables and Questions List of variables to be used to construct the binary variable.
Comment Optional description.
Contains Rule determining how observations are to be selected. The available selections in this section will vary depending on the question type selected in the Variables and Questions box (see below). The possible options include:
- Any of: The observation/observation will be included if they chose any categories specified in the Values box. Respondents may have chosen other categories which aren't selected in the box.
- All of: The observation/respondent will be included only if they chose all categories specified in the Values box. Respondents may have chosen other categories not selected in the box.
- Only/exactly: The observation/respondent will be included if they chose only the category or categories selected in the Values box. They will be excluded if they chose more or fewer categories than the selected ones.
- None of: The observation/respondent will be included if they selected none of the categories specified in the Values box. They may have selected other categories not specified in the box.
- Equals: The observation/respondent will be included if the variable's numeric value matches the value specified exactly.
- Not equals: The observation/respondent will be included if the numeric value of the variable does not exactly match the value specified.
- Greater than: The observation/respondent will be included if the variable's numeric value is larger than the specified value.
- Greater than or equals: The observation/respondent will be included if the variable's numeric value is larger than or exactly matches the specified value.
- Less than: The observation/respondent will be included if the variable's numeric value is smaller than the specified value.
- Less than or equals: The observation/respondent will be included if the variable's numeric value is smaller than or exactly matches the specified value.
Values/Labels Unique values of the variables and questions for use in the construction of the variable.
- For Pick One and the variables in Pick One - Multi questions , Values contains a list of the different categories and Contains gives a choice of Any of and None of.
- For Pick Any questions, Values contains a list of the different categories and Contains offers a choice of Any of, All of, Only/exactly and None of.
- For Text and Text - Multi questions, Values contains a list of the unique text values for the variable and the Contains box will have a choice of Equals and Not equals.
- Numeric Questions and Date Questions, Contains offers a choice of Equals, Not equals, Greater than, Greater than or equals, Less than, Less than or equals and there is a box in which you can enter a value. (The “value” for missing data is NaN; if using a Numeric Variable and you have not explicitly referred to it as NaN, any observations with missing values will automatically be assigned a value of 0 and thus not selected in the resulting binary variable.)
Boolean operators
- + Adds a filter term.
- - Removes selected filter term(s).
- AND ‘And’ logical operator.
- OR ‘Or’ logical operator.
- NOT Logical negation. You may negate any existing term or operator using this button.
Next
- See How to Compute Binary Variables for a list of alternative ways of computing binary variables.
- Multiple Response Data Formats