Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to create method/macro about create dummy variable from categorical data fields ?

kantawee
7 - Meteor

How to create method/macro about create dummy variable from categorical data fields ?

- - Nominal to Numerical (Unique Integer)

my previous method, I use R command in R Tool ., but, i want to easier way to auto generate dummy variable.

Thanks
 


dummy variable.PNG

4 REPLIES 4
NicoleJohnson
ACE Emeritus
ACE Emeritus

I would suggest using the following sequence to get some dummy variables:

 

1. Use Summarize Tool to create a list of your variables

2. Use RecordID to create a numeric value for each variable in the list

3. Use a Find & Replace tool to replace the original value with the new RecordID from your Summarized list

 

Repeat for each variable you wish to replace, and will work for any number of variables!

 

EDIT: Added a sample workflow for a few of the variables.

 

Cheers,

NJ

CharlieS
17 - Castor
17 - Castor

@kantawee

 

In my attached solution, I used a Tile tool to create a unique recordID/numeric assignment for each variable and replaced them in the original set. 

 

The resulting categorical assignment are not Dummy variables, who strictly take a value of 0 or 1. Dummy variables would be useful for statistic analysis, so I've also attached that solution.

kantawee
7 - Meteor

@NicoleJohnson

Well Done, Good Solution ^__^

Thanks madam

kantawee
7 - Meteor

@CharlieS

Oh! Very Nice. Best Solution.

Thanks sir

Labels