BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
wave43
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

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

2 REPLIES 2
sbxkoenk
SAS Super FREQ

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

wave43
Obsidian | Level 7

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 5444 views
  • 2 likes
  • 2 in conversation