This article describes how to go from having a numeric variable represented in aggregate:
To a state where you can assign a numeric variable into categories or bands (e.g., 0, 1-5, 6-10, 11+) for analysis purposes:
You will need to have a numeric variable. Numeric variables have a "2" next to them in the Data Sets tree:
A scaled nominal or ordinal variable if there is text involved with the value label (eg: 0 – Not at all likely and 10 – Extremely Likely are the endpoints of your scale). If using this type of variable, it is prudent to check the Values so that they align correctly with the labels. The Values button is just under the Structure dropdown in the object inspector as per the picture below. You don’t want a value of 1 ascribed to 0 - Not at all likely and so forth (it should be a value of 0). You should change it so that the correct value aligns with the label.
//Identify variable name
x = q1_a_num
//Create banded categories
if (x == 0) 1;
else if (x >= 1 && x <= 5) 2;
else if (x >= 6 && x <= 10) 3;
else if (x > 10) 4;
In the statement above, q1_a_num, is the numeric variable that I would like to create new bands for. You can augment and adjust the code to suit your banding needs, adding as many lines as you like.
4. Once you've made the variable you will need to adjust the Label for each Value, which you can do by going to the Value Attributes window using the Values button in the object inspector.
6. Update the variable structure to nominal by going to Properties > GENERAL > Structure > Nominal: Mutually exclusive categories from the object inspector.
How to Band Numeric Variables using a Table
How to Band Numeric Variables Using R
Article is closed for comments.