Create New Variables - Variables from Merged Categories

From Q
Jump to navigation Jump to search

This tool automates the process of creating new binary variables based on merged categories in Pick One and Pick One - Multi questionsNominal and Nominal - Multi variable sets, where the sets of merged categories are to be the same for each questionvariable set. For example, if you have a battery of 100 11-point scales, and you would like to create variables for the top 4, middle 3, and bottom 4 categories for all of them at once, you can do so using this tool.

Usage

When the tool runs you will be prompted to:

  1. Choose the number of categories in the questions you want to work with. For example, if you are creating new variables from questions that have 7-point scales, you would choose 7 here.
  2. Choose the questions that you wish to create new variables for.
  3. Select the categories you wish to combine.
  4. Enter a label for the new data.
  5. If you wish to create additional questions from the same data, repeat the previous two steps.

If any Don't Know style options are identified you will be given the option to remove them.

  1. Select the variable sets that you want to use under Data Sets. These should be Nominal/Ordinal or Nominal/Ordinal - Multi variable sets.
  2. Run this tool by clicking the plus-sign next to the variables and selecting Anything > Data > Variables > New > Ready-Made New Variables > Binary Variables from Combined Categories (Custom).
  3. Make selections for the sets of categories. Each set will be turned into a binary variable.

Example

Consider the following brand attitude ratings, which are set up as a Nominal - Multi variable set. There are five scale points. Using this tool, we can quickly create binary variables for any combination(s) of those categories, and this can be done for many variable sets at once.

CustomBinaryVariables1.PNG

In this case, we have generated two sets of binary variables. The one on the left shows the results for combining Hate (-2) and Dislike (-1), and the one on the right shows the results for combining Like (1) and Love (2).

Consider the following agreement scale, where we want to create new questionsvariable sets for the Top 2 (1, 2), and Bottom 3 (3,4,5) categories.

PickOneMultiToPickAnyMerge1.PNG

How to apply this QScript

  • Start typing the name of the QScript into the Search features and data box in the top right of the Q window.
  • Click on the QScript when it appears in the QScripts and Rules section of the search results.

OR

  • Select Automate > Browse Online Library.
  • Select this QScript from the list.

Customizing the QScript

This QScript is written in JavaScript and can be customized by copying and modifying the JavaScript.

Customizing QScripts in Q4.11 and more recent versions

  • Start typing the name of the QScript into the Search features and data box in the top right of the Q window.
  • Hover your mouse over the QScript when it appears in the QScripts and Rules section of the search results.
  • Press Edit a Copy (bottom-left corner of the preview).
  • Modify the JavaScript (see QScripts for more detail on this).
  • Either:
    • Run the QScript, by pressing the blue triangle button.
    • Save the QScript and run it at a later time, using Automate > Run QScript (Macro) from File.

Customizing QScripts in older versions

  • Copy the JavaScript shown on this page.
  • Create a new text file, giving it a file extension of .QScript. See here for more information about how to do this.
  • Modify the JavaScript (see QScripts for more detail on this).
  • Run the file using Automate > Run QScript (Macro) from File.

JavaScript

includeWeb('QScript Functions for Combining Categories');
 
applyCustomMerges(true);

See also