Alteryx Designer Desktop Discussions

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

Creating dummy variables

rajeshmr06
5 - Atom

How can I easily create dummy variables for a given Field?

 

For example, let's say a Field Category has the unique values of x,y and z. I want to create dummy_x, dummy_y and dummy_z with values of 1 or 0 based on the Category field. Now, I have more than 3 unique values and it is difficult to create the dummy variables one by one. 

 

Is there a way to dynamically create the dummy variables based on the values of a particular field?

8 REPLIES 8
Rohit_Bajaj
9 - Comet
Hi Rajesh, Can you please some tabular example what is the as-is/source and what the output would look like? Thanks, Rohit
jdunkerley79
ACE Emeritus
ACE Emeritus

Yes you can create dummy for each.

 

The easiest way I can think of is to use a transpose to put all the fields you want to create as rows.

You can then use a formula tool to make a dummy column name.

Then use a cross tab to make it column based.

After this you can use a MultiField formula tool to fill in the nulls.

2016-10-06_09-30-10.jpg

Sample attached

 

 

rajeshmr06
5 - Atom

Thanks, that worked well.

 

CrossTab with the boolean Field added is what I was looking for. 

p_g
5 - Atom

Hi, please could you share what the workflow looks like for the crosstab + boolean field you mentioned?

p_g
5 - Atom

Ignore, it is in 

SanK
5 - Atom

Similar to Nebula's method but slightly straight forward.

Make Dummys_SK.PNG

vannam68
5 - Atom

Thank you for your solution

MarqueeCrew
20 - Arcturus
20 - Arcturus

 Please also try our new macros from CReW

 

https://gallery.alteryx.com/#!app/CReW-Generate-Dummy-Variables/5fca958e0462d71998cd0aac 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels