Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712 will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
I'm not even going to try to create any data set from the posted text.
first I get a mapping key by concatenating the different columns
That sounds like a poorly defined operation to begin with but to duplicate that step you could use in a data step:
MappingKey = catt( var1, var2, var3 <list your variable names).
Please not that most of your "mapping key" values show a beginning C that does not have a column shown that would contribute such. So there seems to be something missing either in the data or your problem description.
You don't really indicate where the BSMap value comes from so I don't know if you are asking for help with that.
... View more