Modify Data - Merge Scales (Custom)
This feature automates the process of combining categories in many Pick One or Pick One - Multi questions , where you would like to combine the same set of categories in each. For example, if you have a battery of 100 11-point scales, and you would like to merge the top 4, middle 3, and bottom 4 categories to all of them at once, you can do so using this feature.
Example
Consider the following likelihood scale, which we want to merge to show the Top 4 (7 to 10), Middle 3 (4 to 6), and Bottom 4 (0 to 3) categories. While you can do this by modifying rows in the table, this feature allows you to apply the same changes to many questions at the same time.
Usage
Start by selecting Automate > Browse Online Library > Modify Data > Merge Scales (Custom). When you use this feature you will be prompted to:
- Choose the number of categories in the questions you want to work with. You example, if you want to merge categories in questions which are 7-point scales, choose 7 here.
- Choose the questions whose categories you wish to combine.
- Select the Source Values for the set of categories that should be combined.
- Enter a label for the new category.
- Repeat until you have specified all the combinations of categories.
If any Don't Know style options are identified you will be given the option to remove them.
Technical details
You should avoid making changes to the questions (e.g. renaming, hiding, or removing categories) prior to using this feature. If you have made changes to your questions , you can revert the changes by selecting a table that shows the question, right-clicking on one of the category labels, and selecting Revert .
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
JavaScript
includeWeb('QScript Functions for Combining Categories');
applyCustomMerges(false)
See also
- QScript for more general information about QScripts.
- QScript Examples Library for other examples.
- Online JavaScript Libraries for the libraries of functions that can be used when writing QScripts.
- QScript Reference for information about how QScript can manipulate the different elements of a project.
- JavaScript for information about the JavaScript programming language.
- Table JavaScript and Plot JavaScript for tools for using JavaScript to modify the appearance of tables and charts.
Displayr - Data Manipulation
Q Technical Reference
Q Technical Reference
Q Technical Reference > Setting Up Data > Creating New Variables
Q Technical Reference > Updating and Automation > Automation Online Library
Q Technical Reference > Updating and Automation > JavaScript > QScript > QScript Examples Library > QScript Online Library