I'm getting the following when I submit the program, create_crtdds_define to batch (non UTF-8):
NOTE: Could not initialize classpath. Classpath variable is not set.
ERROR: 'Invalid byte 1 of 1-byte UTF-8 sequence.'
ERROR: 'com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Invalid byte 1 of 1-byte UTF-8 sequence.'
This does not happen if I submit the program to batch with UTF-8 and it doesn't happen with another study using the same code, when I submit to batch non-UTF-8.
I'm running v9.3 M2 32-bit on Windows Server 2008 R2 64-bit.
The data step from crtdds_write that produces the above messages is:
%* In the following, the logging level is set to info as the transform creates
an empty XML doc if nothing is reported, which causes an error in the SAS libname;
* Create the external XML file from intermediate xml;
data _null_
%* Only use picklist for SAS V9.2 and above;
%if %eval(^ (&SYSVER=9.1)) %then %do;
/ picklist="&_cstJavaPicklist"
%end;
;
dcl javaobj prefs("&_cstParamsClass");
prefs.callvoidmethod('setImportOrExport',"&_cstAction");
prefs.callvoidmethod('setStandardName',"&_cstStandard");
prefs.callvoidmethod('setStandardVersion',"&_cstStandardVersion");
prefs.callvoidmethod('setXslBasePath',tranwrd("&_cstXslReposPath",'\','/'));
prefs.callvoidmethod('setSchemaBasePath',tranwrd("&_cstXsdReposPath",'\','/'));
prefs.callvoidmethod('setSasXMLPath',tranwrd("&_cstCubeXMLPath",'\','/'));
prefs.callvoidmethod('setStandardXMLPath',tranwrd("&_cstExternalXMLPath",'\','/'));
prefs.callvoidmethod('setAvailableTransformsFilePath',tranwrd("&_cstAvailableTransformsPath",'\','/'));
prefs.callvoidmethod('setLogFilePath',tranwrd("&_cstLogXMLPath",'\','/'));
if ("&_cstOutputEncoding" ne '') then do;
prefs.callvoidmethod('setOutputEncoding',"&_cstOutputEncoding");
end;
if ("&_cstHeaderComment" ne '') then do;
prefs.callvoidmethod('setHeaderCommentText',tranwrd("&_cstHeaderComment",'\','/'));
end;
if (&_cstCreateDisplayStyleSheet=1) then do;
if ("&_cstStyleSheetPath" ne '') then do;
prefs.callvoidmethod('setCustomStylesheetPath', tranwrd("&_cstStyleSheetPath",'\','/'));
prefs.callvoidMethod('setOutputStylesheetName', tranwrd("&_cstOutputStyleSheetName..xsl",'\','/'));
end;
prefs.callvoidmethod('createDisplayStylesheet');
end;
* set logging to INFO;
prefs.callvoidmethod('setLogLevelString',"&loglev");
dcl javaobj transformer("&_cstTransformsClass", prefs);
transformer.exceptiondescribe(1);
transformer.callvoidmethod('exec');
* check the return values here and get results path;
transformer.delete();
prefs.delete();
run;
Most likely you have some characters in your source data that are not recognized by the UTF-8 encoding.
A typical example are the 'curly quotes' in text copied from Microsoft Word or Excel.
It would be best to fix this in your source data.
Another option might be to run the %crtdds_write macro with a different _cstOutputEncoding parameter.
Try _cstOutputEncoding=ISO-8859-1 or _cstOutputEncoding=WLATIN1
Also see this usage note: 48520 - SAS® Clinical Standards Toolkit version 1.4 - ERROR: Invalid byte 1 of 1-byte UTF-8 sequence...
PLease note that you do not need to change the macro, but can call it with a different encoding.
If this does not help, please open a ticket with SAS Support (Technical Support Form).
SAS Clinical Standards Toolkit 1.5 (released next week) will have better encoding support.
Lex Jansen
Software Developer@SAS
Message was edited by: Lex Jansen Added usage note reference and CST 1.5
Turns out it was non-breaking spaces, 4 of them. Ack! The metadata spreadsheet from CDISC for 3.1.3. was the culprit for a few and probably me cutting and pasting from the 3.1.3 IG for the others.
Finally I just cycled through each item I was importing from Excel and checked to see which characters were extended ASCII ones and then went back and took care of them.
Thanks for the help!
I'm glad that it got resolved.
We really need a better metadata transport vehicle than Excel!
Lex Jansen
Software Developer@SAS
Hi,
I think I have a similar problem. I am using CST 1.5 and running %crtdds_write( _cstCreateDisplayStyleSheet=1)
I get the following message:
NOTE: Could not initialize classpath. Classpath variable is not set.
ERROR: 'An invalid XML character (Unicode: 0x19) was found in the element content of the
document.'
I found out that my SAS Session Encoding Option is WLATIN1. Therefore I also tried
%crtdds_write( _cstCreateDisplayStyleSheet=1, _cstOutputEncoding=WLATIN1). But it didn't work either, I got the following message:
NOTE: Could not initialize classpath. Classpath variable is not set.
Warning: The encoding 'WLATIN1' is not supported by the Java runtime.
Warning: encoding "WLATIN1" not supported, using UTF-8
Can you help me by any Chance?
Hi,
I solved the problem, Like Susan I just had some odd special characters in my files. Removing all of them solved the problem.
susanne
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.