encode(var,proximity,type,value1[,value2,…valueN])

Takes as input a numeric variable, a real constant proximity, a constant indicating the encoding type, and N constant values, such that N>0. This special transform requires up to N output variable names (except for type=e_range, there are only N-1 outputs), as described in “Transforms With Multiple Outputs”.
For proximity=0. these are the encoding types and what they mean:
  • e_exact
    : Each output column i contains 1.0 if the input variable exactly equals valuei, and 0.0 otherwise, for i=1,…,N.
  • e_lessthan
    : Each output column i contains 1.0 if the input variable is less than or equal to valuei, and 0.0 otherwise, for i=1,…,N.
  • e_range
    : Each output column i contains 1.0 if valuei ≤ the input variable ≤ valuei+1, for i=1,…,N-1.
For proximity>0., in addition to the standard encoding described previously, the output is proportionately between 0 and 1 if (valuei -proximity) ? the input variable's value ? (valuei +proximity).
For example, from
(!a!,!b!,!c!,!d!)=$encode(!var!,0.,$E_RANGE,2.,4.,6.,8.,10.)
the output column !a! will contain 1. when !var! is inclusively between 2. and 4., and 0. otherwise; !b! will contain 1. when !var! is inclusively between 4. and 6., and 0. otherwise, etc. See also strcode(stringVar,value1[,…,valueN]).
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.