Recoding categorical variables

I am trying to use KNIME to recode several categorical variables. For example, one of the variables has 16 different levels, some of which are quite similar and others which have only a few observations. I have tried to use the GroupBY node, but this does not appear to do what I want to accomplish. I am looking for something like the Recode option in SPSS.
Thanks.

Hi @acito

Did you check the rule engine or rule engine dictionary node?
gr. Hans

Thanks for the quick reply. I looked for examples but could not figure out how to use the Rule Engine node. Say I had a variable country with the following list:
USA
Japan
China
France
South Korea
Spain

and I wanted to create a new variable as follows:

South Korea = > Asia
China => Asia
Japan => Asia
Spain => Europe
France => Europe

This is obviously a very simple example, but it reflects what I am trying to accomplish.
Frank

1 Like

Hi @acito , Frank

Try this in the Rule Engine (or see
recode_like_spss.knwf (20.2 KB):

$country$ = "South Korea" => "Asia"
$country$ = "China" => "Asia"
$country$ = "Japan" => "Asia"
$country$ = "Spain" OR $country$ = "France" => "Europe"
TRUE =>  $country$

gr. Hans

3 Likes

Thanks very much. I appreciate it.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.