# How to Compute Binary Variables

There are many different ways of computing Binary Variables in Q. Some of the more common methods are described on this page.

## Contents

## Using the Automate Menu

If you are using Q version 4.8.3.0 or above, you have a menu called Automate which contains various tools specifically for computing binary variables, such as:

- Filtering - Create Filters from Selected Data (note that filter variables are binary variables)
- Create New Variables - Top 2 Category Variable(s) (Top 2 Boxes)

## Changing Question Type

If you have numeric variables or ratings that you wish to make categorical (e.g., if you wish to create a variable with a 1 for people that 'Agree' or 'Strongly Agree' and a 0 otherwise), you can:

- Copy and Paste the numeric or ratings variables to create new variables.
- Change their Question Type to Pick Any.

## Creating combinations of variables

If you wish to create binary variables reflecting all the possible combinations of inputs variables, this is done as follows:

- Select the input variables on the Variables and Questions tab.
- Right-click and select
**Insert Ready-Made Formula(s) > Questions -> Pick Any with All Combinations**.

Or, if you wish to have combinations of only some of the variables, you can do this by creating a Banner question.

## Creating Filters

Create filter variables either by

- 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**to create more complicated logical expressions involving multiple variables (see Binary Variable for more information).

## Constructing New Variables

You can also create new variables where you explicitly type the rules used to create the variables. This can by creating an Excel-Style Variable that only takes values of 0 and 1, but is generally better done by creating a binary variable in JavaScript.