Sometimes it is desirable to only weight a part of the data file. For example, data may have been collected in two regions, and it may be appropriate to weight only one of those regions. The basic process is to set up a weight such that the calculations are done separately for the weighted and non-weighted part of the sample, and to then use a formula variable to remove the weighting from the part of the sample which does not need to be weighted.
Part 1 - Create a filter to identify the sample to be weighted
The first step is to create a variable that separates the part of the sample you want to weight from the total sample.
- Create a filter that represents the respondents to be weighted, calling this filter Sample to be weighted.
- In the Variables and Questions tab, change the Name for the filter to weighted.
Part 2 - Set up the weight variable
Next, you need to set up the weight. This is the same as a normal weight, but incorporates the variable you made above.
- In the Variables and Questions tab, right-click and select Insert Variables > Weight.
- Set up your weight in the normal way, as though you were setting targets for the total sample. For more info on setting targets, see Construct Weight.
- In the Recompute for Each menu, select your Sample to be weighted filter.
- Click OK.
- Change the Name of the newly-created variable to totalWeight.
Placing the Sample to be weighted variable into the Recompute for Each menu causes the weight to be calculated separately for the part of the sample that you want to weight and for the part of the sample that you don't want to weight. While we won't use the weight values that are calculated for the part of the sample which will remain un-weighted, Q does require that a valid weight value be computed for all parts of the sample.
Part 3 - Reset the values for the un-weighted part of the sample
Finally, you can use a formula to reset the weight values for the part of the sample that does not need to be weighted. This is done by assigning a value of 1 in place of the weight values that were calculated in the last section.
- Change the Label of Partial Weight.
- Enter the Expression: if (weighted) totalWeight; else 1
- Press OK.
- Press the yellow W for the variable in the Tags column.
Your weight is now ready to use.