I have a string variable (profile) in my dataset which includes prefixes of H, W, B and the suffix numbers ranging from 1 to 1000 (H1, H2, H3, ..., H1000, W1, W2, W3, ..., W1000, etc). How can I split the prefix characters and the suffix numbers into two different parts. I have tried the below code which generates the suffix numbers but not the character part.
Thanks,
NM
gen iteration = regexs(0) if regexm(profile, "[0-9]*$")
destring iteration, replace
destring iteration, replace
0 Response to Split a string variable into character and numeric parts
Post a Comment