DATA Step, Macro, Functions and more

how to print the special characters in sas log

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

how to print the special characters in sas log

Hi,

 

I am trying to use the code in https://www.pharmasug.org/proceedings/2013/CC/PharmaSUG-2013-CC30.pdf

data _null_;
do k=1 to 255;
x=byte(k);
put k+10 x;end;
run;

 

but in the log, some characters are not displayed correctly.

 

spec char.png

 

 

How to fix this? i tried to change the sas font, but it seems not working.

 

Only some fonts are available in my SAS9.4

sas font.png


Accepted Solutions
Solution
2 weeks ago
SAS Super FREQ
Posts: 8,869

Re: how to print the special characters in sas log

Hi: My guess is that you have to figure out how to change the font in the log for display purposes. That's probably a question for Tech Support.

cynthia

View solution in original post


All Replies
SAS Super FREQ
Posts: 8,869

Re: how to print the special characters in sas log

Hi, I recommend NOT writing to the LOG, or the OUTPUT window. Instead make a SAS dataset and use PROC PRINT so you can control the font and specify a UNICODE font for the output. I like the RTF or PDF example because with COLUMNS= it makes a nice 1 page job aid.

 

cynthia

 

data special;
do k=1 to 255;
  x=byte(k);
  output;
end;
run;

options rightmargin=.5in leftmargin=.5in center nodate nonumber;
ods html file='c:\temp\showspecial.html';
ods rtf file='c:\temp\showspecial.rtf' columns=8;
ods pdf file='c:\temp\showspecial.pdf' columns=8;
proc print data=special noobs
  style(data)={fontface='Arial Unicode MS'};
  title 'Special Characters in Unicode Font';
run;
ods _all_ close;
Occasional Contributor
Posts: 13

Re: how to print the special characters in sas log

Posted in reply to Cynthia_sas

Thank you very much,Cynthia. Yes, my default output is HTML and the unicode is not an issue to HTML.

But actually sometimes there is a need to investigate the special characters in the log for debuging, such as the nested macro call.

 

so is there a way to display the special characters correctly in the log? i tried all the currently available fonts in my SAS9.4, but the special characters(like "é") are replaced by a "?" in the log. so can i add some more fonts to my SAS9.4 to support the unicode in the log and how to do that? 

 

Many thanks in advance.

Solution
2 weeks ago
SAS Super FREQ
Posts: 8,869

Re: how to print the special characters in sas log

Hi: My guess is that you have to figure out how to change the font in the log for display purposes. That's probably a question for Tech Support.

cynthia
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 105 views
  • 1 like
  • 2 in conversation