08-19-2015 09:44 AM
I have some very messy data that i need to clean up. I have this one variable that has a bunch of results put together which i need to somehow separate. The variable looks something like this: abcd - 100efgh - 200ijkl, total - 300
I need it to look like this: abcd - 100; efgh - 200; ijkl, total - 300 or if it's easier separate in 3 variables. Every result is different, meaning there are more than 3 results in one with different formats, but that is the overall issue. I am thinkin the way to solve this is to add a semicolon if there is a letter after a digit. That seems to be the way that would work for all cases. I am just not sure how to do that. Or it it's easier separate it in different variables if there is a letter after a number. Any ideas on how to do that?
Thank you for your help
08-19-2015 10:29 AM
If its only three elements then find should be able to handle it:
a="abcd - 100efgh - 200ijkl, total - 300";
data want (rename=(a=var3));