How to set up qualatative data as a set of binary variables for regression analysis?

DanielManiel

New Member
Joined
May 29, 2017
Messages
2
I am doing a regression analysis and have some data from a survey. One column is ethnicity. The way the data is set up is:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Yearly Salary
[/TD]
[TD]Ethnicity[/TD]
[TD]Age[/TD]
[/TR]
[TR]
[TD]100[/TD]
[TD]Black[/TD]
[TD]25[/TD]
[/TR]
[TR]
[TD]87[/TD]
[TD]White[/TD]
[TD]24[/TD]
[/TR]
[TR]
[TD]57[/TD]
[TD]Black[/TD]
[TD]65[/TD]
[/TR]
[TR]
[TD]94[/TD]
[TD]Hispanic[/TD]
[TD]45[/TD]
[/TR]
</tbody>[/TABLE]

But I would like it set up so that each ethnicity is it's own column:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Yearly Salary
[/TD]
[TD]Black[/TD]
[TD]White[/TD]
[TD]Age[/TD]
[/TR]
[TR]
[TD]100[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]25[/TD]
[/TR]
[TR]
[TD]87[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]24[/TD]
[/TR]
[TR]
[TD]57[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]65[/TD]
[/TR]
[TR]
[TD]94[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]45[/TD]
[/TR]
</tbody>[/TABLE]


Is there a fast way of doing this in excel?
Thanks! :)
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Unknown
ABCD
1Yearly SalaryEthnicityAge
2100Black25
387White24
457Black65
594Hispanic45
6
7
8
9Yearly SalaryBlackWhiteAge
101001025
11870124
12571065
13940045
14
Sheet2
Cell Formulas
RangeFormula
B10=SUMPRODUCT(($A10=$A$2:$A$5)*(B$9=$B$2:$B$5))
C10=SUMPRODUCT(($A10=$A$2:$A$5)*(C$9=$B$2:$B$5))
D10=VLOOKUP(A10,$A$2:$C$5,3,0)
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top