The SAS Output Delivery System and reporting techniques

Using unicode characters in data values in Proc Report

Accepted Solution Solved
Reply
Regular Contributor
Posts: 179
Accepted Solution

Using unicode characters in data values in Proc Report

Hi,

 

I need to be able to assign a unicode character value (SymbolA '1F6B9'x) to a computed variable in Proc Report. Can someone point me to where that is covered in the documentation?  Haven't had much success so far.

 

Thanks!

 

--Ben

 

 


Accepted Solutions
Solution
‎07-13-2016 01:44 PM
SAS Super FREQ
Posts: 8,864

Re: Using unicode characters in data values in Proc Report

Posted in reply to BenConner

Hi:

  I found it. With Arial Unicode MS, it is the same Unicode value. I used the UNICODE function of ODS ESCAPECHAR:

weeman.png

 

ods escapechar='^';
proc report data=pcts nowd;
column client weeman;

define client /display;
define weeman / computed;

compute weeman / character length=50;
 * SymbolA '1F6B9'x;
  weeman='^{unicode 1f6b9}';
  call define(_col_,'style','style={font_face="Arial Unicode MS" font_size=24pt}');
endcomp;
run;

cynthia

View solution in original post


All Replies
Super Contributor
Posts: 439

Re: Using unicode characters in data values in Proc Report

Posted in reply to BenConner

Hi Ben,

 

There is a nice tech paper called "Multilingual Computing with SAS 9.4" that you may find informative. 

 

Also there are some install-time choices where SAS is either installed as single-byte or multi-byte. Depending on the type of deployemnt you have, ranging from local SAS to a remote server access via Enterprise Guide, the technical implications will vary.

Regular Contributor
Posts: 179

Re: Using unicode characters in data values in Proc Report

Posted in reply to jklaverstijn

Thanks so much for the reference!  While I didn't do the install and am guessing, I'm willing to bet it was a single-byte installation, so will have to tweak it a bit.  The good news is I don't have to carry these in to the proc report step as incoming data values so that simplifies it a bit.

 

--Ben

Regular Contributor
Posts: 179

Re: Using unicode characters in data values in Proc Report

Posted in reply to jklaverstijn

I read the white paper and while it gave me good background information, there wasn't enough detail for me to figure out what to do.  Here's a sample code snippet that doesn't work:

 

data pcts;
   client=1; pctype=1; pct=65; output;
run;

proc report data=pcts nowd;
column client weeman;

define client /display;
define weeman / computed;

compute weeman / character length=10;
 * SymbolA '1F6B9'x;
  weeman='01f6b9'x;
  call define('weeman','style','style={fontfamily=SymbolA}');
endcomp;
run;

 

I would like the 'weeman' variable to display the actual SymbolA unicode font value represented by '1f6b9'x.  SAS wanted me to put the 0 in front of the hex string.   Am still missing something basic here.

 

--Ben

SAS Super FREQ
Posts: 8,864

Re: Using unicode characters in data values in Proc Report

Posted in reply to BenConner
Hi:
I do not have the SymbolA font, so I can't run a test. If you look at Arial Unicode MS font is there an equivalent symbol???

cynthia
Regular Contributor
Posts: 179

Re: Using unicode characters in data values in Proc Report

Posted in reply to BenConner

Ah.  Found it.  Needed the ODS escapechar= parm and to define weeman as:

 

weeman='^{unicode "1f6b9"x}';

 

Thanks!

 

--Ben

 

Solution
‎07-13-2016 01:44 PM
SAS Super FREQ
Posts: 8,864

Re: Using unicode characters in data values in Proc Report

Posted in reply to BenConner

Hi:

  I found it. With Arial Unicode MS, it is the same Unicode value. I used the UNICODE function of ODS ESCAPECHAR:

weeman.png

 

ods escapechar='^';
proc report data=pcts nowd;
column client weeman;

define client /display;
define weeman / computed;

compute weeman / character length=50;
 * SymbolA '1F6B9'x;
  weeman='^{unicode 1f6b9}';
  call define(_col_,'style','style={font_face="Arial Unicode MS" font_size=24pt}');
endcomp;
run;

cynthia

Regular Contributor
Posts: 179

Re: Using unicode characters in data values in Proc Report

Posted in reply to Cynthia_sas

Thanks, Cynthia! 

 

This is a good example of taking a graphic image that originally was coded as a series of Drawtext and Drawrectangle GTL statements and converting it to a simpler Proc Report. 

 

The original approach actually had 10 of these images plus some additional text information.  While I don't have an issue with GTL, drawtext statements do not recognize dynamic variables and as a result the SGRender proc can't take advantage of a BY statement when you have a lot of these to generate.  By finding a Proc Report solution, they can be created with one execution of Proc Report and the output directed to a Document Store, and the final output assembled later as needed.

 

Much appreciated!

 

--Ben

☑ This topic is solved.

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

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