Monday, November 24, 2025

Garbled Characters in SAS dataset.

When you see garbled characters like é in a SAS dataset, it usually means the dataset’s encoding tag does not match the actual byte encoding of the data.
SAS assumes the tag is correct, so if the bytes are in a different encoding, the characters display incorrectly.

Below are how I handle this:
1. Confirm transcoding did not occur
2. Create a new dataset containing only the character variable with the garbled text. To avoid transcoding, mark TRANSCODE=NO using the ATTRIB statement.
3. Change the new dataset encoding to the expected one.
4. Verify the string in SAS Universal Viewer, a free tool provided by SAS.

Initially, I considered changing the TRANSCODE property using a PROC DATASETS MODIFY statement. However, this does not work because MODIFY only supports changes to FORMAT, INFORMAT, and LABEL.

No comments: