BookmarkSubscribeRSS Feed
himanshu1105
Calcite | Level 5

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.

7 REPLIES 7
Reeza
Super User

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.


 

himanshu1105
Calcite | Level 5

It is English.

ballardw
Super User

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?

himanshu1105
Calcite | Level 5

Thanks for the reply.

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

himanshu1105
Calcite | Level 5

Thanks for the reply.

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

ballardw
Super User

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)

himanshu1105
Calcite | Level 5

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.

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1435 views
  • 0 likes
  • 3 in conversation