The approach you are taking assumes a hierarchy of race coding. In this case, it is "last one in wins." The reason that the data are collected as multiple separate fields is that individuals can be of multiple races. If you want to collapse it into one field, you have to determine your hierarchy and then program to that.
IF ... THEN race=...;
IF ... THEN race=...;
etc.
evaluates each statement and assigns race based on the sequential evaluation of each IF-THEN statement. So the LAST one with a true IF clause is the result you get.
On the other hand,
IF ... THEN race=...;
ELSE IF ... THEN race=...;
etc.
evaluates and assigns in a hierarchical fashion, so the first IF that is true is the result you get.
You have to make a decision on the utility of the different schemas and program appropriately.
Also, remember that "y" and "Y" are different responses so you may want to use the UPCASE function or check both values.
I think that the code that data_null_ provided makes the assumption that one, and only one, race type will be coded as a "y" and multiple "y"'s are errors. That may or may not be appropriate depending on the source of the data.
Doc Muhlbaier
Duke