BookmarkSubscribeRSS Feed
abdullala
Calcite | Level 5
Using ods rtf as output, how to apply superscript to the axis name? I tried {\super } and seems that axis doesnt recognize it. I am using proc boxplot and proc gplot.
8 REPLIES 8
GraphGuy
Meteorite | Level 14
If it's a simple 1-character superscript that happens to have a character in the font you're using, you can specify the hex-code for that character, like this:

axis1 label=(font="arial" "Squared" 'b2'x);

proc gplot data=sashelp.class;
plot height*weight / vaxis=axis1;
run;
data_null__
Jade | Level 19
That's a good tip, thanks. To get it to work properly with a=90 angled axis you need to include 'b2'x in the string with "Squared". The byte function is handy for that.


[pre]
axis1 label=(a=90 h=14pt font="arial" "Squared%sysfunc(byte(178),$1.)");

proc gplot data=sashelp.class;
plot height*weight / vaxis=axis1;
run;
quit;
[/pre]
Ken_oy
Fluorite | Level 6
@data_null_;

It works great for me. It fixed the problem happens when a=90. Thanks!!
but could you tell me what do 178 $1. mean?

Ken
DanH_sas
SAS Super FREQ
This tip from Robert also works for the SG procedures:

proc sgplot data=sashelp.class;
yaxis label="X(*ESC*){unicode '00b2'x}";
vbar age;
run;
abdullala
Calcite | Level 5
thank you all very much. too bad the font I am using doesnt support it. I wanted a 'square' sign, cm^2.
inteli
Fluorite | Level 6

Please, can you advise on this two challenges I am experiencing?

1. How do I write the superscript for -2 or -3 (i.e. X^-3).

2. Please, what is the code for subscripts?

I will appreciate any help.

DanH_sas
SAS Super FREQ

For axis labels, you will need to use a combination of Unicode characters. Here is a simple example to create X^-4:

 

ods escapechar '~';
proc sgplot data=sashelp.class;
xaxis label="X~{unicode '207b'x}~{unicode '2074'x}"
      labelattrs=GraphUnicodeText;
scatter x=weight y=height;
run;

You must also use a full-featured Unicode font to get many of the super/subscripts in your text. Referencing the GraphUnicodeText style element will give you one of those fonts that is also appropriate for your style.

 

Hope this helps!

Dan

inteli
Fluorite | Level 6

Many thanks.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 4962 views
  • 3 likes
  • 6 in conversation