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"?
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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: