This article describes how to create weights in situations where you want to collapse or merge different categories of a target variable.
Knowledge of weighting in Q. See: How to Configure a Weight from Variable(s)
The instructions below describe how you would weight by age and gender, where, for males, the age categories are under 40 versus 40+, for females, they are under 50 versus 50+, and the targets are 25% in each of the four cells.
- Select the variable that you wish to have different mergings of (in this case, age) in the Variables and Questions tab.
- Right-click and select Copy and Paste Variable(s) > Linked
- Right-click on the new variable and select Edit variable.
- Replacing the Expression with the following, where you substitute age and gender for whatever variable Names are applicable: if (gender == 1) 99; else age;
- Change the Label to something instructive, e.g., "Age Groups Male".
- Click OK.
- Right-click on the new variable and select Copy and Paste Variable(s) > Exact Copy.
- Right-click on the new, copied, variable and select Edit variable, updating the Expression to: if (gender == 2) 99; else age;
- Change the label to, e.g., "Age Groups Female".
- Click OK.
- Repeat this process for any remaining categories of the first variable.
- In the menu, go to Create > Variables and Questions > Variable(s) > Weight.
- In the Adjustment Variable(s) drop-down, select the first newly created variable.
- Merge together the categories as desired by dragging and dropping, but leaving 99 unmerged.
- Enter appropriate targets. For example, 25%, 25%, and 50%, where the last category is the sum of all the other targets.
- Click and repeat the previous three steps for any remaining variables.
- Click OK when finished.