How To Convert Binary Variables Into Max-Multi Format

From Q
Jump to navigation Jump to search

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

  1. In the Variables and Questions tab, right-click and select Insert Variable(s) > JavaScript Formula > Numeric.
  2. Fill in as follows:
    1. Name: mm1
    2. Label: Variable 1
    3. Expression: Enter the expression below, but replacing the list of variable names in the second row with the list of your binary variables' names.
  3. Press OK.
  4. Right-click on the variable that has just been created and select Copy and Paste Variable(s) > Exact Copy.
  5. Right-click on the new variable and select Edit Variable.
  6. Replace the number 1 in each of the Name, Label and first line of the Expression with a 2.
  7. Press OK.
  8. 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){
    return indexes;
getAllIndexes(variables, 1)[number - 1] + 1