I have a dataset with race and ID:
ID Race
1 White
1 Declined to Answer
2 Alaskan Native
3 Unknown
3 African American
4 White
4 Native Hawaiian
I would like for the dataset to have one ID and one race. If the race is 'Unknown' or 'Declined to Answer' I would like to have Race be valued as the the race that is known (White for ID #1 and African American for ID #3). If there are two races valued, I would like the value to be the more uncommon race (Native Hawaiian for ID #4). I would ideally like to have a dataset that looks like:
ID Race
1 White
2 Alaskan Native
3 African American
4 Native Hawaiian
I appreciate any help!!
Can you provide some example code? This explanation isn't very clear to me. Thank you
I have a dataset with race and ID:
ID Race
1 White
1 Declined to Answer
2 Alaskan Native
3 Unknown
3 African American
4 White
4 Native Hawaiian
I would like for the dataset to have one ID and one race. If the race is 'Unknown' or 'Declined to Answer' I would like to have Race be valued as the the race that is known (White for ID #1 and African American for ID #3). If there are two races valued, I would like the value to be the more uncommon race (Native Hawaiian for ID #4). I would ideally like to have a dataset that looks like:
ID Race
1 White
2 Alaskan Native
3 African American
4 Native Hawaiian
I appreciate any help!!
How do you define "uncommon race"?
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!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: