Defining segment rules

Segment rules are used throughout the application to select and allocate records in different applications as appropriate. Segments are defined by one or more expressions that return a true or false result. For example, you might have a rule with a single segment that returns true if the value of the age field is less than 18. Segments can be defined based on fields or expressions defined in the data, or on the propensity scores or predictions returned by a model. In applications with a Define tab that are configured to have multiple dimension hierarchies (referred to as elements), you can also choose from other dimension members. See the topic Project configuration for more information.

Each segment is defined by one or more expressions, and returns a value of true if all conditions are met. For example, a segment defined by age and gender would only include records that met both conditions, and the rule would return false for all others.

To create or edit a segment rule

  1. In the application where you want to add the rule, click the Create a new rule icon.
  2. Specify a name for the rule.
  3. For the input column, click the down-arrow icon to specify a field, rule, or model, as desired.
    Table 1. Input column options
    Icon Usage
    If enabled, allows you to select a dimension member from a previously defined element.
    Allows you to choose a field from the current data set.
    Allows you to choose an existing model or rule from the repository.
    Allows you to build a new model.
    Allows you to build an expression.
  4. Choose the function you want to use. See the following table for available options.
    Table 2. Available operators
    Value type Available operators
    Time stamp, Date, Date time
    • = (equals)
    • != (not equal to)
    • > (greater than)
    • < (less than)
    • >= (greater than or equal to)
    • <= (less than or equal to)
    • BETWEEN
    • ISNIL
    • IS NOT NIL
    A range
    • = (equals)
    • != (not equal to)
    • > (greater than)
    • < (less than)
    • >= (greater than or equal to)
    • <= (less than or equal to)
    • BETWEEN
    • ISNIL
    • IS NOT NIL
    • ONE OF
    • NOT ONE OF
    A set
    • = (equals)
    • != (not equal to)
    • ISNIL
    • IS NOT NIL
    • ONE OF
    • NOT ONE OF
    A flag
    • = (equals)
    • != (not equal to)
    • ISNIL
    • IS NOT NIL
  5. Specify a value as appropriate for the input type. For non-numeric values, a dropdown list of choices is provided.

Alternatively, click the Find an existing rule icon to browse for rules that have already been defined. See the topic Exporting and reusing rules for more information.

Note that a segment rule such as Age BETWEEN 50 and 20 will not return results. It is the same as the expression x <= value and value < y, which can never be true. This is consistent with SQL Server behavior. Age BETWEEN 20 and 50 is the correct format.

Also note that a segment rule such as Gender = $null$ will not return results either. If you want to filter out the fields for which the Gender value is empty, you can instead use an expression like Gender Not One Of (Male, Female).

Segment rule sets

  • Segment rules can also be combined into sets. A segment ruleset returns a value of true if any of the individual segments is true. Note this differs from the expressions within a segment, all of which must be true.
  • You can export segment rulesets from any application that uses rules, or you can do this in IBM® SPSS® Rules Management if available. See the topic Exporting and reusing rules for more information.