01-11-2012 02:57 AM
I have simple task - replace new line symbol to simple space character.
So some sas table has character cell and this cell has long string with new line characters inside, and I need just replace all these symbols to space symbols.
Looks like this task can be simple resolved by simple sas perl function:
Where X- new line character(or appropriate code) that I actually can't find , and ColName is the name of character column that has this new lines symbols.
Will be grateful for any help!
01-11-2012 08:43 AM
Regular expression is overkill for such a simple task.
You can use translate to replace single characters with other characters. Note that the order of the arguments to translate seems backwards, which I assume you can blame on the IBM mainframe command that SAS used in the old days.
Also you can use TRANWRD to replace substrings with replacement text.
01-11-2012 09:10 AM
Thanks, I supposed that perl fucntion will perfom this operation fuster, but may be really simple tranwrd function will work quicker, I'll look into it.
01-11-2012 09:25 AM
One other comment. The newline "character" means different things on different operating systems. So Tom's '0A'x would work for Unix (which just uses the linefeed as a newline marker). Windows uses the two character combination of <CR><LF> to mark the end of a line ('0D'x).
The perl function knows which OS you are on and adjusts accordingly.
Need further help from the community? Please ask a new question.