When you transcode a zoned decimal variable using code similar to the following, the operation fails:
data test;
informat a zd9.2;
format a dollar13.2;
a=.;
run;
data null;
file "utf8test.csv" encoding = 'utf-8' stopover lrecl = 32767 recfm = v;
set work.test;
put a ;
run;
FATAL: Wide character FILE/INFILE/FILENAME options have been specified. Wide character support is
not currently enabled.
FATAL: Unrecoverable I/O error detected in the execution of the DATA step program.
Aborted during the INITIALIZE EXECUTION phase.
The ZDw.d informat causes the fatal error even though there is no INPUT statement.
A workaround is to use the KCVT function and remove the ENCODING option from the FILE statement. Here is example modified code:
data test;
informat a s370fzd9.2;
format a dollar13.2;
a=.;
run;
data null;
file "utf8test.csv" stopover lrecl = 32767 recfm = v;
set work.test;
b=put(a,dollar13.2);
c = kcvt(b, 'wlatin1','utf-8');
put c ;
run;
When you use the modified code, the fatal error is no longer written to the SAS log.