Hello,

I have an alphanumeric string variable that have different characters for each observation. Eg: 678-xyz, 678-qrs, 677-abcd, 20, 100 . There are only these 3 types of suffixes. Some values have no suffix. Values without any suffix run from 1 to 620. Values with suffix run from 621 to 1200.

I want to convert these values to a numeric format as follows:
  • 10678 (for values that have -xyz suffix) i.e. add a prefix of 1 or 10 in place of -xyz suffix -to make it a 5 digit number.
  • 20678 (for values with -qrs suffix) i.e. add a prefix of 2 or 20 in place of -qrs suffix -to make it a 5 digit number.
  • 30677 (for vallues with -abcd suffix) i.e. add a prefix of 3 or 30 in place of -qrs suffix -to make it a 5 digit number.
  • 40020, 40100 (for values without any suffix such as 20, 100 etc)- add a prefix of 4 or 40 or 400 or 4000 to make it a 5-digit number.
Any tips on an efficient way to do this would be hugely appreciated!

Thanks