Example
The first image below shows a summary table of the Age question from a study next to the underlying values. While the age groups have been merged on the table the underlying data still contains distinct values for all of the original categories. These underlying values will be used if the Age question is used to create a weight, but we would really prefer to use the two merged categories for creating the weight.
The second image shows a summary table of a new version of the Age data that has been generated by this tool. While the table appears the same as the previous one, the underlying values now contains only two distinct values. This new merged, Age - Merged can now be used to construct a weight based on targets for the Under 40 and 40 and over groups.
Technical details
This tool uses a JavaScript formula to construct the merged categories. If any of the original categories from the data are not shown on the table and not included in any of the merged categories (which can happen when rows are hideen on the table), then respondents from those categories will be assigned to a category called Missing Data and given a value of -99.
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
- Contact support@q-researchsoftware.com to obtain a copy of the JavaScript code.
- 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.
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.