Hi,
I need to have unicode character 3251 (circled number 21) appear as a symbol on a graph in sgplot.
However, an open square appears on the graph instead of the circled 21 when I create the graph.
It appears that this is happening because the font I am using does not support that unicode character.
I tried sevral different fonts and nothing worked.
Is there a specific font that I need to use for this, or are ther any other solutions?
Thanks!
Where is it supposed to appear? Title text, axis label, axis tickmark label, data label in the body of the graph?
Show the actual code and/or value of the variable that you are using.
Depending on your current SAS session settings and where you want to use the value you may have to have a value like
(*ESC*){unicode <codevalue>}
which sometimes means creating a new variable that is longer to hold all those characters and may require the value to be in hex notation such as {unicode '03B2'x} which is the greek letter beta
Hi ballardw,
The characters need to appear as marker symbols in the body of the graph.
Below is the code where I used symbolchar to create the each symbol with the unicode character.
This works fine for the symbols with numbers 1 through 20.
However, starting with 21 it is a different charcater code set and everything 21 and above does not work.
Thanks!
PROC SGPLOT DATA = map_coordinates noborder nowall NOAUTOLEGEND NOCYCLEATTRS sganno = annoImage;
TITLE;
YAXIS grid gridattrs = (color = black) display = (noline nolabel noticks novalues) values=(0 to 100 by 5);
XAXIS grid gridattrs = (color = black) display =(noline nolabel noticks novalues) values=(0 to 100 by 5);
symbolchar name=one char='2460'x / textattrs = (weight = bold);
symbolchar name=two char='2461'x / textattrs = (weight = bold);
symbolchar name=three char='2462'x / textattrs = (weight = bold);
symbolchar name=four char='2463'x / textattrs = (weight = bold);
symbolchar name=five char='2464'x / textattrs = (weight = bold);
symbolchar name=six char='2465'x / textattrs = (weight = bold);
symbolchar name=seven char='2466'x / textattrs = (weight = bold);
symbolchar name=eight char='2467'x / textattrs = (weight = bold);
symbolchar name=nine char='2468'x / textattrs = (weight = bold);
symbolchar name=ten char='2469'x / textattrs = (weight = bold);
symbolchar name=eleven char='246A'x / textattrs = (weight = bold);
symbolchar name=twelve char='246B'x / textattrs = (weight = bold);
symbolchar name=thirteen char='246C'x / textattrs = (weight = bold);
symbolchar name=fourteen char='246D'x / textattrs = (weight = bold);
symbolchar name=fifteen char='246E'x / textattrs = (weight = bold);
symbolchar name=sixteen char='246F'x / textattrs = (weight = bold);
symbolchar name=seventeen char='2470'x / textattrs = (weight = bold);
symbolchar name=eighteen char='2471'x / textattrs = (weight = bold);
symbolchar name=nineteen char='2472'x / textattrs = (weight = bold);
symbolchar name=twenty char='2473'x / textattrs = (weight = bold);
symbolchar name=twentyone char='3251'x / textattrs = (weight = bold);
symbolchar name=twentytwo char='3252'x / textattrs = (weight = bold);
symbolchar name=twentytheree char='3253'x / textattrs = (weight = bold);
symbolchar name=twentyfour char='3254'x / textattrs = (weight = bold);
symbolchar name=twentyfive char='3255'x / textattrs = (weight = bold);
symbolchar name=twentysix char='3256'x / textattrs = (weight = bold);
styleattrs datasymbols = (
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
twentyone
twentytwo
twentythree
twentyfour
twentyfive
twentysix
);
SCATTER x = X_Coordinate y = Y_Coordinate/
markerattrs = (size = 16) group = site_number nomissinggroup name = 'sites';
yaxis min=0 max=100 /*grid values=(0 to 100 by 5)*/ offsetmin=0 offsetmax=0 display= none;
xaxis min=0 max=100 /*grid values=(0 to 100 by 5)*/ offsetmin=0 offsetmax=0 display=none;
run; quit; ods listing close;
I think you are running into this from the Symbolchar statement online help:
Tip This statement attempts to access the specified Unicode value in the current font. Some fonts do not support accessing characters by using their Unicode value. Other fonts support only a limited set of Unicode values. If the Unicode value is not accessible, then this statement might be ignored or a nonprintable character might be substituted.
I had the same result you do with all of the fonts I tried so it may be that many font "designers" don't see a need for the circle numbers past 20.
If you find something where it resolves properly try using that Font in a TEXTATTRS with the Family option. Since fonts aren't the same across installations I am not sure which to suggest.
/*Here is a workaround way.*/
data have;
set sashelp.class;
if age<14 then char='21';
else if age<15 then char='22';
else char='23';
run;
proc sgplot data=have nocycleattrs noautolegend;
scatter x=weight y=height/ markerattrs=(symbol=circle size=20) group=char;
scatter x=weight y=height/markerchar=char markercharattrs=(size=10) labelstrip group=char ;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.