## Introduction

While it's typical for a multiple response question to be expressed as a binary - meaning each selection will be coded into its own variable, some may opt to condense this into fewer options. For instance, if a question has 30 brands, but one could select no more than 6 brands - it's possible to store the data as only 6 variables. This is sometimes called 'max-multi'.

## Method

To convert data from a binary to max-multi format:

- In the Variables and Questions tab, right-click and select
**Insert Variable(s) > JavaScript Formula > Numeric**. - Fill in as follows:
**Name**:`mm1`**Label**:`Variable 1`**Expression**: Enter the expression below, but replacing the list of variable names in the second row with the list of your binary variables' names.

- Press
**OK**. - Right-click on the variable that has just been created and select
**Copy and Paste Variable(s) > Exact Copy**. - Right-click on the new variable and select
**Edit Variable**. - Replace the number
`1`in each of the**Name**,**Label**and first line of the**Expression**with a`2`. - Press
**OK**. - Keep repeating the previous four steps, adding
`1`each time, until the**Mean**shown at the bottom-right corner of the dialog box becomes`NaN`. At this point, you have all the max-multi variables required to represent the binary data.

var number = 1; var variables = [q5_1,q5_2,q5_3,q5_4,q5_5]; function getAllIndexes(arr, val) { var indexes = [], i = -1; while ((i = arr.indexOf(val, i+1)) != -1){ indexes.push(i); } return indexes; } getAllIndexes(variables, 1)[number - 1] + 1