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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 8 replies
  • 3641 views
  • 3 likes
  • 6 in conversation