BookmarkSubscribeRSS Feed
SusanParker
Calcite | Level 5

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;

5 REPLIES 5
Lex_SAS
SAS Employee

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

SusanParker
Calcite | Level 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!

Lex_SAS
SAS Employee

I'm glad that it got resolved.

We really need a better metadata transport vehicle than Excel!

Lex Jansen

Software Developer@SAS

sanbra
Fluorite | Level 6

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?

sanbra
Fluorite | Level 6

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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

Discussion stats
  • 5 replies
  • 3441 views
  • 2 likes
  • 3 in conversation