The SAS Output Delivery System and reporting techniques

Weird Symbols in WORD output

Reply
Occasional Contributor
Posts: 5

Weird Symbols in WORD output

Weird Japanese symbols are being printing when I try to use following code to get Superscripts for my column headers:

 

%let x=%sysfunc(byte(185));
%put &x;

%let y=%sysfunc(byte(178));
%put &y;

 

define name / order order=data  width=12 left flow "Name/~Family Name&x./~Age/Surname&y."; 

 

I use SAS 9.4.

If I generate a RTF file everything is fine but when i try to generate WORD file these symbols (ケ,イ) show up in my report instead of ¹ and ².

Has anybody faced similar kind of thing before ? Please Help.

Super User
Posts: 20,688

Re: Weird Symbols in WORD output

Posted in reply to himanshu1105

What's the default language set up on your computer?

 


himanshu1105 wrote:

Weird Japanese symbols are being printing when I try to use following code to get Superscripts for my column headers:

 

%let x=%sysfunc(byte(185));
%put &x;

%let y=%sysfunc(byte(178));
%put &y;

 

define name / order order=data  width=12 left flow "Name/~Family Name&x./~Age/Surname&y."; 

 

I use SAS 9.4.

If I generate a RTF file everything is fine but when i try to generate WORD file these symbols (ケ,イ) show up in my report instead of ¹ and ².

Has anybody faced similar kind of thing before ? Please Help.


 

Occasional Contributor
Posts: 5

Re: Weird Symbols in WORD output

It is English.

Super User
Posts: 11,765

Re: Weird Symbols in WORD output

Posted in reply to himanshu1105

The characters with ASCII codes above 127 are FONT dependent.

 

You want to look to using UNICODE symbols as the font being used is doing something odd, likely using something that is not a simple ASCII encoding so extra byte(s) are added to the characters shifting them to oddness.

What ODS Style are you using when creating that RTF file?

Occasional Contributor
Posts: 5

Re: Weird Symbols in WORD output

Thanks for the reply.

I use ods style = analysis. That's what the workplace standards are.

Occasional Contributor
Posts: 5

Re: Weird Symbols in WORD output

Thanks for the reply.

I use ODS style = analysis. That's what the workplace standards are.

Super User
Posts: 11,765

Re: Weird Symbols in WORD output

Posted in reply to himanshu1105

When I run this code:

ods rtf file='d:\junk.rtf'
style=styles.analysis;

data _null_;
   file print;
   put "Name/~Family Name&x./~Age/Surname&y."; 
run;
ods rtf close;

I get

 

                                                                                                  

--------------------------------------------------------------------------------------------------

                                                                                                  

Name/~Family Name¹/~Age/Surname²                                                                  

 

which shows the superscripts. See if you get a similar result pointing to a valid location for the file of course. (Pasting rtf tables sucks on this site)

Occasional Contributor
Posts: 5

Re: Weird Symbols in WORD output

Thanks for the reply.

I use the following code to:

%macro special_char(unicode=, name=);
%global &name;
data _null_;
A=input("&unicode."x,$UCS2B4.);
call symput("&name.",trim(left(A)));
stop;
run;
%put Note: special_char: &name = ->|&&&name.|<- ;
%mend;

%special_char(unicode=00B9,name=super1);
%special_char(unicode=00B2,name=super2);

 

I get the RTF, right.
But as i run VBScript to convert it to .DOCX the 1,2 get converted to ケ and イ.

This is really weird, as this is happening for only one file. I use the same code for all the files and other outputs look fine.

 

Ask a Question
Discussion stats
  • 7 replies
  • 323 views
  • 0 likes
  • 3 in conversation