Posts

Showing posts from 2025

Power Up Your Data Cleaning with the SAS COMPRESS Function

Power Up Your Data Cleaning with the SAS COMPRESS Function When handling large datasets in SAS, it's common to encounter unwanted characters, extra spaces, or other clutter that can hamper your data analysis. Fortunately, the COMPRESS function helps you clean up your text data efficiently. It can remove, or even keep, specific characters from your strings with minimal effort. Keep reading to learn how you can harness the full potential of the SAS COMPRESS function. 1. Quick Overview of the COMPRESS Function The COMPRESS function in SAS removes (or optionally keeps) certain characters from a character string. Its basic syntax looks like this: result_string = COMPRESS(source_string ); source_string : The original string you want to modify. characters_to_remove (optional): A list of specific characters to eliminate. modif...

Solving Non-Printable Characters in AETERM/MHTERM for SDTM Datasets

Solving Non-Printable Characters in AETERM/MHTERM for SDTM Datasets Solving Non-Printable Characters in AETERM/MHTERM for SDTM Datasets Managing text variables in SDTM domains such as AETERM (for Adverse Events) or MHTERM (for Medical History) can be challenging when non-printable (hidden) characters sneak in. These characters often arise from external data sources, copy-pasting from emails, encoding mismatches, or raw text that includes ASCII control characters. In this post, we’ll explore methods to detect and remove these problematic characters to ensure your SDTM datasets are submission-ready. 1. Identifying Non-Printable Characters Non-printable characters generally fall within the ASCII “control” range: Hex range: 00 – 1F and 7F Decimal range: 0 – 31 and 127 In SAS, you can detect these characters by examining their ASCII values using RANK() , or by leveraging built-in functions like ANYCNTRL() . ...