I am not surprised … The two technologies, SAS Transport 5 and XML do not fit together - blame FDA for refusing to move to modern Dataset-XML instead of SAS Transport (5 or 8).
In XML, single quote is a special character. See e.g. https://www.xmltutorial.info/xml/special-characters-in-xml/ (and many other places).
So, if you have a single quote that is in a text that is in a Define-XML attributed, like in “CodedValue” within “CodeListItem”, you need to replace the single quotes by their “entity”, which is ’
If you use a good tool to generate your define.xml (which the Define-XML team encourages people to do BEFORE generating the datasets - the define.xml is “the specification”), the tool will take care of that for you.
Also, please take into account that SAS Transport only supports US-ASCII characters. Although the normal single quote is supported by US-ASCII (code 39), when copying values from other sources (automatically or manually), you may come to surprises when one or more characters are non-US-ASCII. For example, I have seen people having “skew” (MS Office) quotes being copied to the SAS Transport 5 file, leading to … disaster. Are your single quotes such “skew” characters?
How P21 Validator treats non-ASCII characters that occur in SAS Transport files, I cannot say. Maybe these are ignored … That may explain the behavior that you found.
With best regards,
Jozef Aerts
CDISC XML Technology team