Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Grouping variables to create new variables SAS Enterprise Miner

Accepted Solution Solved
Reply
Contributor
Posts: 31
Accepted Solution

Grouping variables to create new variables SAS Enterprise Miner

What is the best way to group variables into a new variable (or replace existing one) in SAS Miner?

 

For example, the variable "color" has 4 values: Red, Green, Black, and White. I want to create a new variable "newcolor" which has values "No Color" for Black and White, and "Color" for Red and Green.

 

Thanks.


Accepted Solutions
Solution
‎01-14-2016 09:59 AM
SAS Employee
Posts: 51

Re: Grouping variables to create new variables SAS Enterprise Miner

Hello,

 

What you want to do is creating a new variable by grouping levels (!) of a nominal variable.

 

In SAS Enterprise Miner, this can be done in multiple ways:

1. Replacement Node

2. Transform Variables node

3. entering code in the score code pane of the Code node

 

I would start with the Replacement node:

- Put the 'Default Limits Method' for interval variables on 'NONE'.

- Open the Replacement Editor for Class Variables.

- Enter replacement values in the only column you can edit.

 

The new variable will have the same name as the source variable but with an added prefix (I believe it's 'REP_' for the replacement node). The original source variable will get a 'rejected' role and the new derived variable will get an 'input' role (unless you are replacing the target variable, then the new variable will get the 'target' role).

 

Koen

View solution in original post


All Replies
Solution
‎01-14-2016 09:59 AM
SAS Employee
Posts: 51

Re: Grouping variables to create new variables SAS Enterprise Miner

Hello,

 

What you want to do is creating a new variable by grouping levels (!) of a nominal variable.

 

In SAS Enterprise Miner, this can be done in multiple ways:

1. Replacement Node

2. Transform Variables node

3. entering code in the score code pane of the Code node

 

I would start with the Replacement node:

- Put the 'Default Limits Method' for interval variables on 'NONE'.

- Open the Replacement Editor for Class Variables.

- Enter replacement values in the only column you can edit.

 

The new variable will have the same name as the source variable but with an added prefix (I believe it's 'REP_' for the replacement node). The original source variable will get a 'rejected' role and the new derived variable will get an 'input' role (unless you are replacing the target variable, then the new variable will get the 'target' role).

 

Koen

Contributor
Posts: 31

Re: Grouping variables to create new variables SAS Enterprise Miner

Thank you. The replacement node was straight forward. You saved me from reloading my data again.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 812 views
  • 1 like
  • 2 in conversation