05-21-2013 06:18 PM
I want to convert a character variable (stub) to a new variable (stub1). Rules are that the first 5 or 6 characters before m or e are kept (e.g, B01001e1 -> keep B01001 and B01001Ee -> keep B01001E) and that numbers after m or e are added to three digits (e.g. 1 -> 001, 12 -> 012, 123 -> 123).
B01001e1 -> B01001001
B02001m12 = B02001012
B01001Ee1 -> B01001E001
B05003Fm123 -> B05003F123
How can I deal with this matter? Thank you so much
05-21-2013 06:37 PM
You can look at some string functions such as compress using e/m as delimiters as well as translate to do the conversion for the other characters, or a format that does the conversion for the second part would also work.
05-21-2013 07:51 PM
This is to follow Fareeza's logic. I am sure there would be better code than the following:
input var $20.;
05-21-2013 08:06 PM
same but different.
Need further help from the community? Please ask a new question.