BookmarkSubscribeRSS Feed
anshul_900
Calcite | Level 5

I have a RTF macro which does not use the  ods statements but did set up a rtf table in the specified format. We have been using wingdings and monotype sorts to get special symbols such as check marks until now but now I need to use unicode values so that i can get the checkmark symbol with Segoe UI Symbol font but since am not using ods statement anywhere I am not able to let SAS know that it needs to treat the unicode value as unicode and not a normal symbol.

 

data mh._&mea.3 ;
length name $ 300;
set _&mea._kd
%if &mea. = ABC %then %do;
/* Creating an array for all plan variables and replacing its value with a rtf symbols for Tick symbol. F4 is for windings font and ü is unicode */
array travelplansss {*} &mea._:;
do k = 1 to dim(travelplansss);
travelplansss[k] = tranwrd(travelplansss[k] ,"\b\cf2\ Check Plan\b0" , "\f9\cf1 ^{unicode 2714}");
end;
%end;
%else %if &mea. = CPA%then %do;
array travelplansss {*} &mea._:;
do k = 1 to dim(travelplansss);
travelplansss[k] = tranwrd(plansss[k] ,"\b\cf11\ Delta Care\b0\cf0" , "^{unicode 2714");
end;
%end;
%else %do;
array travelplansss {*} &mea._:;
do k = 1 to dim(plansss);
travelplansss[k] = tranwrd(travelplansss[k] ,"\b\cf6\Check Status\b0" ,"^{unicode 2714");
end;
%end;
run;

 

 

data _null_ ;
file "&sumrepOutput.\_&mea..rtf" ;
set &st.&yr.&pp._&mea.3 end= eof ;
if _N_ = 1 then do ;
%rtf (0) ;


%rtf(&n_cols., &cw1. 8 8 12 7 10 8 7,
b=1, v=a, h=a, hline=t,/* hborder=brdrhair,*/ s=30 30, w=&width., clalign=b, shade=\clcbpat&TpT1., vborder=brdrhair) ;
%rtf (100) ;
end;

run ;

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

I am unsure I understand your aim, but here is how to insert a unicode character into a RTF file:

 

ods rtf file="test.rtf";
proc print data=sashelp.class; run;
ods rtf close;

data t;
 infile "test.rtf";
 file   "test1.rtf";
 input; 
 _infile_=tranwrd(_infile_,'Barbara','\u1576?ar\u1576?ara');
 put _infile_;
run;

I inserted Arabic letter bāʼ ب, instead of the letter b :

Capture.PNG

 

 

 

 

anshul_900
Calcite | Level 5

Hello Chris, Thank you for the response. However when am trying to use the same code which you provided to test the waters, i am not getting the expected output.  The only difference I made is that I changed the unicode value to 2713 which represents checkmark but instead I am getting a gujarati letter Nga which has corresponding unicode of 0A99. Can you think of something as to why this has happened? 

Also why to use ? after the unicode. I did notice that the output rtf gets corrupted if I remove it but can you explain the specific purpose of it.

 

Below is the code snippet

 

data t2;
infile "C:\test.rtf";
file "C:\\test11.rtf";
input;
_infile_=tranwrd(_infile_,'Barbara','\u2713?');
put _infile_;
run;

ChrisNZ
Tourmaline | Level 20

2713 decimal =0A99 hex.

Use \u10003  for a check mark.

The ? tells the application what to display if the character cannot be displayed. i.e. display a question mark. As far as I know.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 823 views
  • 0 likes
  • 2 in conversation