Hello! I am trying to create a new variable from multiple dummy variables in a secondary data analysis. These are race variables, where each race is represented by a separate 0/1 (no/yes) dummy variable. Due to the size of my dataset and the type of analysis, I can't look at each race as a separate category, and want to create a binary variable: white (0) and BIPoC (1). To further complicate this issue, participants can say yes to as many racial groups as they identify with, so I can't simply say "if white then 0 and if [any other race variable] then BIPoC, because people with multiple racial identities would be counted multiple times. I think I've figured out what I need, conceptually, but I don't know how to write the code. Below is my best description of the concept:
If racevarwhite = 1 and all other racevar2-8 = 0 then newracevar = 0 (i.e. white)
If racevarwhite = 1 and any other (combination of) racevar2-8 = 1 then newracevar = 1 (i.e. BIPoC) AND
If racevarwhite = 0 and any other (combination of) racevar2-8 = 1 then newracevar = 1
In other words, if white only, then 0 for newracevar and if any other combination of 1s whether inclusive of white or not, then newracevar = 1. Any assistance writing this code would be greatly appreciated! Thank you!
If racevarwhite = 1 and all other racevar2-8 = 0 then newracevar = 0 (i.e. white)
If racevarwhite = 1 and any other (combination of) racevar2-8 = 1 then newracevar = 1 (i.e. BIPoC) AND
If racevarwhite = 0 and any other (combination of) racevar2-8 = 1 then newracevar = 1
In other words, if white only, then 0 for newracevar and if any other combination of 1s whether inclusive of white or not, then newracevar = 1. Any assistance writing this code would be greatly appreciated! Thank you!
Comment