Skip to content

Numeric banding

This conversion bands (or bins) numeric data. It is typically used to make a standard and easy to use banded version of numeric data. This banded version is convenient for the FastStats end user for point and click selection and Cross Tabs etc.

Note

Numeric banding operations (equal ranges, log ranges, deciles, n-tiles) can be calculated “on the fly” from a numeric variable by using FastStats and the results can be saved as virtual variables.

The same operations can be performed as Post-Load Scripts. However it is sometimes useful to band numerics at the build stage: this has the disadvantage (or advantage) that the bandings are fixed and enables you to avoid storing the real numeric variable if only the banding is useful.

To produce a banded selector: define the selector over the top of the field that contains the value. This is most easily achieved using an Alias. The Decodes for a numeric band include descriptions that specify the range.

Numeric bands

Individual descriptions to be parsed as ranges on numeric bands can have any one of the following syntax:

  • X - Y where X and Y are lower and upper inclusive bounds respectively separated by a hyphen.
  • X exactly X
  • X+ representing greater than or equal to X.
  • >X representing greater than X.
  • <X representing less than X.
  • >=X representing greater than or equal to X.
  • <=X representing less than or equal to X.
  • X - -Y represents a range between two negative numbers, from -X to -Y.
  • -X - +Y represents a range from -X to +Y across the origin.

In general text before, after and between numbers is ignored when interpreting the numeric range but is stored for use as descriptions for Analysis Table labels etc. The characters -, +, >, < should however only be used for defining ranges as above. Invalid ranges are ignored. Note that, during loading, a record will be classified into the first range that it satisfies, so you should always use an unclassified.

This is how FastStats interprets some typical numeric ranges:

Range Lower Upper Note
£20 - 30 20.00 30.00 -
> 65.00 65.00 MAX -
65.00+ 65.00 MAX -
>=65.00 65.00 MAX -
-23.89 to -10.81 -23.89 -10.81 -
-10 to +10 -10 10 -
Unknown MAX MAX i.e. invalid range
£0.00 0.00 0.00 i.e. 0.00 exactly
<100 -MAX 99.99.. -
<=100 -MAX 100.00 -
50 50.00 50.00 -
Missing Value MAX MAX i.e. invalid range

In the above interpret MAX as “largest number”. All bands are treated as inclusive at both ends and a value will be selected under the first band that it falls into.

Example

The source data field that contains the total number of orders for a customer. We wish to band these into 5’s up to a maximum of 20, with the final band containing anything 20 and above. We also need to have a separate band for zero orders.

Code Description
! Unclassified
A 0 Orders
B 1-4 Orders
C 5-9 Orders
D 10-14 Orders
E 15-19 Orders
F 20+ Orders

If the incoming value is non-numeric or matches none of the ranges it will be assigned to the first band - by convention the “Unclassified” category. The codes assigned to each range are not significant but must be unique.