How to Cap Weights

From Q
Jump to navigation Jump to search

Capping a weight refers to limiting the maximum value that a weight can take. For example, where weights are capped at 5 it means that any weight computed to be greater than 5 is returned as a 5. It is done in Q as follows:

  1. Create a weight in one of the usual ways.
  2. In the Variables and Questions tab select the weight variable.
  3. Right-click on the weight variable and select Copy and Paste Variable(s) > Linked.
  4. Right-click on the newly created variable (which is under the one that was copied) and select Edit Variable.
  5. Create appropriate entries for Name and Label and set Expression to Math.min(maxValue,weightVariable) where weightVariable is the name of the variable that is the current weight and maxValue is the maximum value that you wish the weight to take (i.e., the cap).
  6. Review the Result field in the Preview of results and press OK.
  7. Press W.png for the new weight variable.
  8. Apply the newly created weight on the tables and charts to be weighted on the Outputs Tab.