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"?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.