Where a data file contains two distinct weight variables, such as one weight designed to rectify an imbalance in the sample (e.g., over- and under-representation by age, gender, and geography), and another which represents some aspect of the importance of the respondent (e.g., number of purchases) you can combine weight variables by multiplying them together in a new JavaScript variable.
Requirements
More than one weight variable
Method
- In the Data Sources tree, hover and click + > Custom Code > JavaScript > Numeric.
-
Enter the following code into the Code
panel, where weight1 and weight2 are the names of the two weight variables. If you have additional weight variables to combine, continue to add them using the same format.
//Multiply all weight variables together weight1 * weight2 - Click Calculate.
- Give this new variable a Name and a Label in Properties
> General.
- Tick Data > Attributes > Usable as a weight in Properties
to make this variable available to be used as a weight.
UPCOMING WEBINAR: Run Research Your Way With AI Skills