02-03-2017 01:47 AM
I have a string like POST 1234 ST NO 50.
I need the string to be standardized as POST 1234 STREET NO 50.In the strings i need to change only ST as STREET.
Many Thanks In Adavnce For Your Response,
02-03-2017 04:46 AM
I am using SAS Dataflux and standardization node in the data job. When i am trying to replace ST as STREET ,the words like POST is changing as POSTREET.
02-03-2017 02:01 AM
Without seeing the rest of your data, it's hard to give a hard and fast answer. This will work for the example you've given, however:
length address $ 50;
address = 'POST 1234 ST NO 50.';
address = tranwrd(address, ' ST ', ' STREET ');
tranwrd changes character strings, whereas translate changes single characters. Note that I have prefixed and suffixed the two strings with spaces, because POST would have been changed as well. However you may strike problems with ST., where a full-stop is after the string - you may have to put in two tranwrd calls to cope with this. I have a very large and complex macro which does exactly this, but it may be more than you need.
Note that the parameter order for tranwrd is different to translate (which only changes single characters): the second parameter is what you want to change, the third is what you want it to change to.
02-03-2017 04:38 AM
If I was "standardising" that data, I would want to create variables specific for each data element. E.g.
Rather than replacing some text, and then having to analyze the text each time I wanted to use it.
Need further help from the community? Please ask a new question.