Creating flag variables for aggregation
The SetToFlag node is a very convenient node that converts a single nominal variable into as many binary columns as desired, one column for each nominal variable value. However, the default values for the node are T
and F
, which unfortunately cannot be used for any nodes that require numeric values. In this recipe we will create flag variables that can be used in Aggregate nodes, Means nodes, and other numeric operations. Using numeric values (1
and 0
in this recipe) will work with any nodes that require flag or nominal values such as Association Rules and the grouping variable for the Means node (as T and F will), but will also work as numeric values in nodes such as the Aggregate node.
Getting ready
This recipe uses the datafile cup98lrn_reduced_vars3.sav
and the stream recipe_variableconstruct_flags.str
.
How to do it...
- Open the stream
recipe_variableconstruct_flags.str
by clicking on File | Open Stream. - Make sure the datafile points to the correct...