Data visualization with SAS programming

Special characters in axis label

Reply
Occasional Contributor
Posts: 17

Special characters in axis label

Hi,

I want to write for example µ in axis labels but it doesn't work.

I keep the label in a macro variable and if I do the instruction put in order to see it in the log, the µ is written but on the graph, there is only °

Here is my code if it can help you :
goptions reset=all ftext=sasmonospace htext=1 ctext=black devmap=winansi keymap=winansi;
axis1 order=&min to &max label=("&x_lab ");
axis2 label=(angle=90 "&y_lab ") order=&min to &max;

symbol1 interpol=join value=none color=blue line=20;
symbol2 interpol=join value=none color=red line=1;
symbol3 interpol=none value='Circle' color=black;

legend1 label=none
mode=reserve
position=(bottom center outside)
offset=(0.5,)
across=3
shape=line(4)
value=('Perfect Concordance Line' 'Observed Concordance Line' ' ');

%macro graphe(yf,xf,minf,maxf);
%if &minf=0 or &maxf=0 %then %do;
proc gplot data=graphe_finale;
plot &yf*&xf Ybissector*i Yobserved*i/ overlay haxis=axis1 vaxis=axis2 legend=legend1 vminor=0 hminor=0 annotate=annoter ;
run;
quit;
%end;
%else %do;
proc gplot data=graphe_finale;
plot Ybissector*i Yobserved*i &yf*&xf/ overlay haxis=axis1 vaxis=axis2 legend=legend1 href=0 vref=0 vminor=0 hminor=0 annotate=annoter ;
run;
quit;
%end;
%mend graphe;
%graphe(&Y,&X,&min,&max)

By advance, thanks a lot,

Céline
SAS Super FREQ
Posts: 864

Re: Special characters in axis label

Hey Celine,

Can you give an example of the string assigned to &x_lab or &y_lab?

Thanks!
Dan
Super Contributor
Posts: 273

Re: Special characters in axis label

Céline
In sas graph a greek letter is possible
see
http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0806A&L=sas-l&P=R22438&D=1&H=0&O=D&T=1

What i have never tested is their use
inside the axis statement due to another general ftext choice
I never use sasmonospace into sas graphs!

Another question is related to your graph : alone or inside an ods destination?

Andre
Trusted Advisor
Posts: 1,328

Re: Special characters in axis label

All valid comments above:
- what is the value of x_lab?
- do you use ODS?
- you must use another font.

You can assess fonts using:


goption ftext=greek;
*goption ftext='arial';
*goption ftext='verdana/bo';

proc gslide;
note height=2 "%sysfunc(getoption(ftext))";
%macro t;
%do i=32 %to 255 %by 32;
note height=2 %do j=&i %to %eval(&i+31); "%sysfunc(byte(&j))" %end; ;
%end;
%mend;%t
run;
quit;
Super Contributor
Posts: 273

Re: Special characters in axis label

Celine
(now from work)

See it is working

ods listing close;
ods rtf file="d:\temp\greekfigure.rtf" style=minimal;

goptions device=png rotate=landscape gsflen=132 border htitle=1 htext=1;

proc gplot data=sashelp.class;
title2 font=cgreek height=1.5 'a b c d e f g h i j k l m n o p q r s t u v w x y z';
title3 font=cgreek height=1.5 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z';
axis1 order=10 to 20 label=(font=swiss "La " font=greek " m" font=swiss " des ados");
plot age * weight/haxis=axis1;
run; quit;
ods rtf close; ods listing;
SAS Super FREQ
Posts: 864

Re: Special characters in axis label

Here is yet another possibility. If you are running SAS 9.2, here's a trick you can use with the SG procedures. You can inline unicode character directly in the string. Taking Andre's example:

proc sgplot data=sashelp.class;
xaxis min=10 max=20 label="La (*ESC*){unicode mu} des ados";
scatter x=weight y=age;
run;

Notice that you do not have to change fonts in the middle of the label.
Post a Question
Discussion Stats
  • 5 replies
  • 640 views
  • 1 like
  • 4 in conversation