Binary Variable

From Q
Jump to navigation Jump to search
Related Online Training modules
Complicated Filters
Generally it is best to access online training from within Q by selecting Help > Online Training

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:

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 AddFilterTerm.png (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.

Values/Labels Unique values of the variables and questions for use in 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.

See also