Sometimes, it is necessary to have different weighting structures for different time periods. For example, in Quarter 1, it may be appropriate to weight by age and gender, whereas in Quarter 2, it may make more sense to weight by Geography. There are lots of different ways of achieving this, two of which are described below.
Requirements
- One or more variables in your data set that you want to use to create weights. These variables can be categorical or numeric.
- The targets for each category in the weight variable. These can be percentages or population counts.
- Variables need to be single-choice. You cannot use multi-choice variables.
Method
There are lots of different ways of achieving this, two of which are described below.
Method 1
- Set up the targets for the first time period (see How to Configure A Weight from Variable(s)).
- Within the same New Weight window, change Recompute for each to the time variable (i.e., the variable that demarcates each of the weighting structures) and press OK.
- Change the Variable Name of the new weight variable to weight1.
- Repeat the above steps for each of the time periods.
- In the Data Sources tree, hover and click Plus (+) > Custom Code > JavaScript - Numeric.
- Enter your JavaScript code into the code editor window. See the example below, which creates a combined weight variable based on the individual weight variables created in Steps 1-4 above.
if (wave == 1)
weight1;
else if (wave == 2)
weight2;
else if (wave == 3)
weight3;
else
weight4;
7. Click Calculate to run the code and create the JavaScript variable.
8. Select the JavaScript variable in the Data Sources tree and tick the Usable as a weight box in the Object Inspector.
Method 2
This method is often the easiest. However, it is also the most susceptible to making mistakes that can be hard to spot and even harder to fix. You should only use this method if there is a good reason not to use the other methods.
- Obtain a separate data file for each wave.
- Create the weight.
- Save as an SPSS data file using Share > Export Data > Download as SPSS File(.SAV).
- Merge the data files (see How to Combine Data Files by Adding New Records).