The default operation of table recoding requires the entire attribute to match the entry in the recode table. For example, if the recode table is specified to change 'World' to 'Y,' and the input data is "Hello World, " recoding will not be performed because the entire attribute (Hello World) does not match the table entry (World) even though it contains the string 'World.'
If you want to look-up part of the attribute, use the Phrase Separator option in the Table Recode window. The Phrase Separator option allows you not only to select portion of the attribute, but also control the separator characters and other variations.
To use the phrase separator option
-
In the Table Recode window, check Use phrase separator and select or specify the following options:
Option
Description Example
Any
Any character including a space can be a separator.
Recode Table: World, Y
Input Data: Hello World
Result: Hello Y
The result is "Hello Y" because 'World' is found in the input data and the space is used as a separator.
None Use no separators. The entire attribute is required to match the entry in the recode table. Recode Table: World, Y
Input Data: Hello World
Result: Hello World
The recoding will not be performed because the entire attribute (Hello World) does not match the table entry (World).
Explicit
Specify any character or a list of characters that are used to separate the string in the attribute.
Example: / .,?"$<>
Recode Table: World, Y
Input Data: Hello/World
Explicit: /
Result: Hello Y
The result is "Hello Y" because 'World' is found in the input data and the backslash (/) is used as a separator.
Look-up Position Select a position of the phrase separator.
- Beginning of phrase
- End of phrase
- Anywhere in phrase
Recode Table: World, Y
Input Data: Hello World/
Look-up position: End of phrase
Result: Hello Y
The result is "Hello Y" because 'World' is found in the input data and the separator (/) is found at end of the phrase.
Phrase Recode Only Recode only the look-up value itself, not the entire attribute. This option is selected by default. When this option is not selected, the entire attribute will be recoded. This option is typically used to set a flag in a different attribute whenever a specified value is found in the input data.
Note: This operation is subject to the previous options such as the explicit separator and look-up position.Recode Table: World, Y
Input Data: Hello World
Separator: Any
Phrase Recode Only: ON (default)
Result: Hello Y
The result is 'Hello Y' because 'World' is found in the input data, the space is used as a separator, and the matching string (World) is recoded to 'Y.'
Phrase Recode Only: OFF
Result: Y
The result is 'Y' because 'World' is found in the input data, the space is used as a separator, and the entire attribute is recoded to 'Y.'
-
Click Next to specify the match attributes and recode attributes.