Return to Homepage

Goto the Tip of the Month Archive

Other interesting pages ...
LinkedIn Profile
SAS Cheat Sheet
Useful SAS Code
Full SAS Example
Basic Statistics
Contact Information

SAS Tip of the Month
October 2014
(for SAS)

Sometimes in a text string we are processing there is a tab, linefeed or carriage return character (or characters) in the text. Removing them can be challenging, but here is a piece of code that may help that replaces non-printable characters with a blank:

.  * Verify each byte in string until no more non- printable characters are found;
   do until(_flg=0);
      _flg=notprint();
      *If a non-printable is found, replace with a space;
      if _flg>0 then substr(,_flg,1)=' ';
   end;

Hope this is useful. See you next month.

________________________________
Updated October 2, 2014