BookmarkSubscribeRSS Feed
klongway
Calcite | Level 5

I have 8 racial variables, and participants can choose up to eight. The majority of people choose one or two, but I have 300 people who I've recorded as multiracial, due to clicking more than one option. I did this via making new variables and assigning 1s to the boxes that were checked, making it so that everyone who chose one race ended up with a score of one, and everyone who chose more than one was greater than one.

 

Now that I've identified multiracial participants, I'd like to get the breakdown of single race participants- should I do that via dropping my multiracial participants? If I just run the original racial variables, the system chooses whatever is marked first- so if you marked black, white, and native american, you'd just show up as black. 

 

My end goal is to have a statement like:

 

"300 participants chose more than 1 racial identifier and were considered multiracial. Of those 300, X percent identified as 2 races and X percent identified as 3 or more. Of the X participants who chose one racial identifier, X% identified as Black, X% identified as White, etc"

 

Example code:

 

If wh=1, then Nwh=1

If wh=0 then Nwh=0 

If bl=2 then Nwbl=1

If bl=0 then Nwbl=0

This is repeated for all racial variables, then I have:

 

If Nwh+NwBl=1 then Prace="single"

If Nwh+NwBl>=2 then Prace="multi"

 

(except with all 8 variables going into the statement, not just the 2 example ones)

5 REPLIES 5
PaigeMiller
Diamond | Level 26

@klongway wrote:

 

Example code:

 

If wh=1, then Nwh=1

If wh=0 then Nwh=0 

If bl=2 then Nwbl=1

If bl=0 then Nwbl=0

This is repeated for all racial variables, then I have:

 

If Nwh+NwBl=1 then Prace="single"

If Nwh+NwBl>=2 then Prace="multi"

 

(except with all 8 variables going into the statement, not just the 2 example ones)


I have trouble understanding this code and logic ... and you didn't show us the data ... but if I am understanding you properly, you can use the SUM function to obtain whether or not the person identifies with one or more races

 

numrace=sum(of racevariable1-racevariable8);

or if the variables are not consecutively numbered

 

numrace = sum (white,black,orange,green, ... );

(where of course you use the actual names of the variables)

and then

 

length prace $ 6;
If numrace=1 then Prace="single";
else Prace='multi';

I would also suggest instead of creating a character variable Prace, you create a format and apply it to NUMRACE.

 

This whole solution assumes that your race variables have values 0 or 1 and not anything else, which I don't think you actually said.

--
Paige Miller
ballardw
Super User

@klongway wrote:

I have 8 racial variables, and participants can choose up to eight. The majority of people choose one or two, but I have 300 people who I've recorded as multiracial, due to clicking more than one option. I did this via making new variables and assigning 1s to the boxes that were checked, making it so that everyone who chose one race ended up with a score of one, and everyone who chose more than one was greater than one.

 

Now that I've identified multiracial participants, I'd like to get the breakdown of single race participants- should I do that via dropping my multiracial participants? If I just run the original racial variables, the system chooses whatever is marked first- so if you marked black, white, and native american, you'd just show up as black. 

 

My end goal is to have a statement like:

 

"300 participants chose more than 1 racial identifier and were considered multiracial. Of those 300, X percent identified as 2 races and X percent identified as 3 or more. Of the X participants who chose one racial identifier, X% identified as Black, X% identified as White, etc"

 

Since you say "identified as white", that implies that you have more variables then you are indicating. Or are you assuming that the first choice selected is "identifies as"?

 

Unless there has been a specific report requirement generated before analysis to report this way I would tend to leave Multiracial as a single group if you don't have a separate question that has the "identify as" information.

 

BTW, I've worked with data with multiple race categories that included an "identify as" that would get answers other than any of  the races recorded in the race response. Which is one reason unless required I'll leave things at multiracial.

klongway
Calcite | Level 5

Sorry, my posts on this forum are never clear, especially since I can't copy my data or actual code over per my data use agreement. 😞

 

I guess I'm asking- is there a way, after I have the multiracial participants identified (as they are var1 var2 var3...>=2), is there a way to sort of...sequester the multiracial participants, so I can find out the distribution of the single race (non-multiracial) participants?  Would a drop statement work for this? 

PaigeMiller
Diamond | Level 26

@klongway wrote:

Sorry, my posts on this forum are never clear, especially since I can't copy my data or actual code over per my data use agreement. 😞

 

I guess I'm asking- is there a way, after I have the multiracial participants identified (as they are var1 var2 var3...>=2), is there a way to sort of...sequester the multiracial participants, so I can find out the distribution of the single race (non-multiracial) participants?  Would a drop statement work for this? 


Yes there is a way, and I answered that earlier in this thread.

--
Paige Miller
klongway
Calcite | Level 5

I'm sorry PaigeMiller, I didn't see your response until I'd replied above.

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 632 views
  • 0 likes
  • 3 in conversation