Search code examples
saspmml

else clause in pmml derivedfield


In derivedfield in pmml, for making local transformation I used the code below

<MapValues outputColumn="longForm">
  <FieldColumnPair field="gender" column="shortForm"/>
  <InlineTable>
    <row><shortForm>m</shortForm><longForm>male</longForm>
    </row>
    <row><shortForm>f</shortForm><longForm>female</longForm>
    </row>
  </InlineTable>
</MapValues>

In that code if shortform is m it returns "male", and if shortform is f it returns "female". Also I want want to add else clause for that code. If shortfrom is not m or f it should returns "unknown". How can I do that?


Solution

  • You should specify MapValues@defaultValue attribute:

    <MapValues outputColumn="longForm" defaultValue="unknown">
      ...
    </MapValues>