06-19-2015 03:34 PM
I hope someone can give me an assist here.
I have text data in one variable that varies in length. The field begins with a name and contains the word "ZIP" somewhere in the string. I need to find the occurrence of "ZIP" and remove all text after that occurrence to the end of the string.
Is there anyone who could point me in the right direction?
Thank you very much.
John M. Smith ZIP 99999 any town any city
Mary M. Smith any town any city ZIP 88888 some other text
Bill Murray title book ZIP
John M. Smith
Mary M. Smith
06-19-2015 03:41 PM
string = substr(string,1,(indexw(string,'ZIP')));
Where String is the name of your variable with the text. Note that the search is case sensitive, if you have values of Zip or zip they won't match.
Need further help from the community? Please ask a new question.