The SAS Output Delivery System and reporting techniques

Unicode text in ExcelXP output

Reply
Occasional Contributor
Posts: 18

Unicode text in ExcelXP output

Hi all,

I'm having some issues generating customized output using excelXP.

I need to be able to display an uppercase sigma in excel output via the excelxp engine, but i cannot get the escape character to resolve to the proper unicode text.

For example, if i specify

ods escapechar="^";

prior to the rest of my code, my title statement

the text resolves to {unicode 03A3x} in the relevant title cell.

How can i get the text to resolve to the greek sigma?  Or, is it simply not possible?

Any input from the experts?

Occasional Contributor
Posts: 18

Re: Unicode text in ExcelXP output

I should add -- I have all of this compiling in a macro, so it is possible that the escapechar is not resolving properly due to being nested within a macro.

Trusted Advisor
Posts: 1,131

Re: Unicode text in ExcelXP output

Hi

i tried the below code and it resolved to uppercase Sigma. Use ' (single quotes) instead of double quotes for 03A3.

ODS Escapechar='^';

Title "Sas Session ^{unicode '03A3'x}";

I tested the above code in sas enterprise guide.  could you check the sas version.

Thanks,

Jag

Thanks,
Jag
Occasional Contributor
Posts: 18

Re: Unicode text in ExcelXP output

Hi Jag,

I will look into using single quotes instead of double -- i had been using double quotes because the code is nested within a macro

some thing along these lines:

%macro excelloop;

ods escapchar="^";

ods tagsets.excelxp

filename...

title1 "Sas example ^{unicode '03A3'x)";

proc report ...;

run;

%mend;

%excelloop;

SAS Super FREQ
Posts: 8,743

Re: Unicode text in ExcelXP output

Hi:

  Part of the beauty of the Unicode function with ODS ESCAPECHAR is that you do NOT need to use quotes. For example, refer to page 4 in this paper

http://www2.sas.com/proceedings/sugi31/227-31.pdf (page 4)

or look in the doc

http://support.sas.com/documentation/cdl/en/odsug/66611/HTML/default/viewer.htm#p11xia2ltavr8ln17srq...

http://support.sas.com/documentation/cdl/en/grstatug/63302/HTML/default/viewer.htm#n14y94tov3cxxjn1v...

or run this program below.

Cynthia

ods tagsets.excelxp file='c:\temp\uni_symbols.xml' style=sasweb

    options(embedded_titles='yes');

ods escapechar='^';

title 'Unicode symbol is ^{unicode 03A3}';

title2 'Unicode by glyph name is ^{unicode sigma_u}';

title4 'Unicode Alpha Glyph is ^{unicode alpha}';

title3 'Unicode Beta is ^{unicode 03B2}';

title5 'Unicode Gamma is ^{unicode 03B3}';

proc print data=sashelp.class(obs=3);

run;

ods tagsets.excelxp close;

Occasional Contributor
Posts: 18

Re: Unicode text in ExcelXP output

Cynthia, Jag:

In order to figure out whether the issue had to do with Excel, my macro, or my sas implementation, i rant the following code;

options nonumber nodate;

ods escapechar='^';

ods pdf file="foo.pdf";

title 'Unicode Alpha is ^{unicode 03B1}';

title2 'Unicode Alpha is ^{unicode alpha}';

title3 'Unicode Beta is ^{unicode 03B2}';

title4 'Unicode Gamma is ^{unicode gamma}';

title5 'Unicode Sigma is ^{unicode 03C3}';

proc print data=sashelp.class(obs=1); run;

ods _all_ close;

result is a pdf which the line: Unicode Sigma is ^{unicode 03C3}

I'm beginning to think that my issue is not my code, but rather my sas implementation.  I am running sas 9.3 on a server, SAS TM Level 1M2 X64_ESRV08.

Is it possible that there is a package i need to install for this to all work?

Thanks,

Ben

PROC Star
Posts: 7,364

Re: Unicode text in ExcelXP output

You may just be using a font that is too limited.  Have you tried?:

/* Change unicode font to something with more characters in it */

/* Copy this to 'unicode.sasxreg' */

/*

[ODS\DESTINATIONS\PRINTER]

"Unicode Font"="Arial Unicode MS"

*/

proc registry import = 'unicode.sasxreg'; run;

As suggested in: Base SAS: Enhancements to Inline Formatting in SAS 9.2

SAS Super FREQ
Posts: 8,743

Re: Unicode text in ExcelXP output

Hi:

  I agree with Art. I think you have a font issue. Running your code results in the screen shot of the PDF output below.

cynthia


show_glyphs.png
Occasional Contributor
Posts: 18

Re: Unicode text in ExcelXP output

I resolved the issue by running my code in a SAS unicode environment, as opposed to English.  Works perfectly, now.

Ask a Question
Discussion stats
  • 8 replies
  • 926 views
  • 1 like
  • 4 in conversation