Hi,
I have a string variable called "name". For this variable, each observation contains several words (for example: John Anthony Smith). I would like to order the words of each observation according to the lexicographical order (for example: John Anthony Smith becomes Anthony John Smith).
The only solution I have found is to separate each word of the string into a specific variable, do a reshape (wide to long), do a sort, and reshape from large to wide. On big data set it takes a lot of time. Is there a fastest way?
Thank you very much!
Antoine
I have a string variable called "name". For this variable, each observation contains several words (for example: John Anthony Smith). I would like to order the words of each observation according to the lexicographical order (for example: John Anthony Smith becomes Anthony John Smith).
The only solution I have found is to separate each word of the string into a specific variable, do a reshape (wide to long), do a sort, and reshape from large to wide. On big data set it takes a lot of time. Is there a fastest way?
Thank you very much!
Antoine
Comment