This week our SAS paper review looks at “Non Printable & Special Characters: Problems and how to overcome them” by Sridhar R Dodlapati, Praveen Lakkaraju, Naresh Tulluru and Zemin Zeng.
The paper looks at the problems which can be caused when non-printable and special characters such as line feeds and carriage returns are present in SAS datasets, how to detect them and how to replace the.
Non printable and special characters can be a source of confusion when they are encountered in SAS, the programmer often only detects them by chance when they notice that the alignment in an output report seems to be disrupted for no apparent reason. A systematic approach to detecting and handling special characters is clearly required in situations when special characters can be reasonably expected and this is just what is set out in this paper.
The paper describes a clear approach for detecting special characters and explains three keyapproaches for dealing with them:
1. Report them to data management and get clean data in the next transfer.
2. Replace NPSC with other characters.
3. Delete NPSC.
Particularly useful is the recommendation to use the compress option with the ‘KW’ modifier (new to SAS version 9) to only keep writable characters.
The paper includes several worked examples as well as useful code fragments.
The paper was presented at the PharmaSUG conference in Orlando 2010. Download the paper here.