Colleagues,
I have a string variable resembling the data generated by the code below. I would like to achieve two things:
I have a string variable resembling the data generated by the code below. I would like to achieve two things:
- Create a separate variable containing figures in brackets
- Create a separate variable with figures saved at the end of the variable
- Each observation contains two sets of figures, both of variable lengths from 1 to 3 digits
- First set of figures is always encapsulated in brackets
- Second set of figures is always at the end
- Each observation contains at least one word at the beginning of the variable
- On some occasions additional words appear between the figures
- There is no word at the end of the observation
- There are blank spaces at the end or beginning of the observation
Code:
/* === SampleString Data === */ clear input str27 problemvar "abcXYZ (90) 135 " "def (130) comment 20 " "mbnuiegh (1) koj 130 " "wshli (786) kojepj (11) " "oujiopwe kojkl we (09) 787 " " ecfh (11) comment 90 " end
Comment