BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jb3
Obsidian | Level 7 jb3
Obsidian | Level 7

Hi all,

 

I would like to use the unicode symbols for <= and >= in a SAS/Graph legend in SAS 9.4M2 on Windows. The unicode symbols are assigned using proc format. How can I achieve this? I use the code below, and the unicode symbol is not rendered as a symbol but as text.

 

Thanks for your help!

Jonas

 

 

goptions reset=all;

proc format;
	value hp
		low-100 = "'2264'x <= 100" 
		100-150 = "101 - 150"
		150-high= ">= 101"
	;
run;

legend1 label=none;

proc gchart data=sashelp.cars;	
	pie Horsepower / 
		discrete
		value=none 
		slice=outside
		other= 0
		legend=legend1
	;
	format Horsepower hp.;
run;

  


SAS Unicode in Legend.png
1 ACCEPTED SOLUTION

Accepted Solutions
GraphGuy
Meteorite | Level 14

One way to do this in SAS/Graph would be to specify *all* the characters in the legend as their 4-digit unicode number. This is a bit cumbersome, but if you only have one (or a few) graphs, perhaps it's an acceptable work-around(?)

 

proc format;
	value hp
		low-100 = '226400a0003100300030'x
		100-150 = '00300030003100a000ad00a0003100350030'x
		150-high= '226500a0003100300031'x
	;
run;

legend1 label=('Horsepower: ') value=(justify=left font='albany amt/unicode');

proc gchart data=sashelp.cars;	
	pie Horsepower / 
		discrete
		value=none 
		other= 0
		legend=legend1
	;
	format Horsepower hp.;
run;

horsepower.png

View solution in original post

5 REPLIES 5
jklaverstijn
Rhodochrosite | Level 12

Hi Jonas,

 

Have a look at this blog post: http://blogs.sas.com/content/graphicallyspeaking/2015/07/29/unicode-in-formatted-data-sas-9-40m3/.

 

It does exactly what you're looking for, although it does require SAS 9.4M3! Kudos to Sanjay Matange.

 

Regards, Jan.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

You will want to a) move to sgplot and gtl, b) check out this blog which has code examples on everything sgplot/gtl related.  Note in this link I have filtered for exactly what you request, but do have a look at the whole blog as there are many examples:

http://blogs.sas.com/content/graphicallyspeaking/?s=unicode

 

 

jb3
Obsidian | Level 7 jb3
Obsidian | Level 7
Thanks for your answers. Is there really no chance of doing this in SAS/Graph?
jklaverstijn
Rhodochrosite | Level 12

I have given it a shot but the approach taken by the blog is ODS, and thus limited to ODS graphics. So it won't work from eg. the Bar Chart task in EG.

 

There are examples floating around using hex characters (ALT-codes from the keyboard) in the labels but the results I had with a quick test were inconsistent. But you may want to give that a try.

 

Reg's Jan.

GraphGuy
Meteorite | Level 14

One way to do this in SAS/Graph would be to specify *all* the characters in the legend as their 4-digit unicode number. This is a bit cumbersome, but if you only have one (or a few) graphs, perhaps it's an acceptable work-around(?)

 

proc format;
	value hp
		low-100 = '226400a0003100300030'x
		100-150 = '00300030003100a000ad00a0003100350030'x
		150-high= '226500a0003100300031'x
	;
run;

legend1 label=('Horsepower: ') value=(justify=left font='albany amt/unicode');

proc gchart data=sashelp.cars;	
	pie Horsepower / 
		discrete
		value=none 
		other= 0
		legend=legend1
	;
	format Horsepower hp.;
run;

horsepower.png

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 3684 views
  • 5 likes
  • 4 in conversation