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;
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;
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.
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
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.
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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: