BookmarkSubscribeRSS Feed
Melk
Lapis Lazuli | Level 10

I am trying to add a superscript in my title and this is what is happening. I am using SAS 9.4 - can anyone help identify the problem based on the image? Thank you.

 

ods escapechar='^';

proc sgplot data=datnoautolegend;
title "My Plot: Volume(ml^{sup 2})";

...

 

 sas.png

12 REPLIES 12
PeterClemmensen
Tourmaline | Level 20

I think you need to use the super keyword like this

 

ods escapechar='^';
title "My Plot: Volume(ml^{super 2})";

proc print data=sashelp.class;
run;

@Melk , does that work for you?

Melk
Lapis Lazuli | Level 10
I tried that as well, but the results are the same.
PeterClemmensen
Tourmaline | Level 20

Are you directing output to an external source or HTML?

 

When I run it, I see this

 

 

Capture.PNG

Melk
Lapis Lazuli | Level 10

Hm, I am looking at it in my results viewer and exporting as rtf file, and still getting the same thing.

ballardw
Super User

Version of SAS?

And show your code from the ODS RTF statement to the ODS RTF close.

 

My title in RTF shows

My Plot: Volume(ml2)

Melk
Lapis Lazuli | Level 10
I have SAS 9.4.

ods rtf file='temp.rtf';
proc sgplot data=dat noautolegend;
title "My Plot: (ml^{super 2})";
scatter x=new_method y=gs;
run;
quit;
ods rtf close;
ballardw
Super User

@Melk wrote:
I have SAS 9.4.

ods rtf file='temp.rtf';
proc sgplot data=dat noautolegend;
title "My Plot: (ml^{super 2})";
scatter x=new_method y=gs;
run;
quit;
ods rtf close;

Try adding NOGTITLE to the ODS RTF options. I think with the title out of the graph that RTF has a better chance of showing the text as desired. The default for RTF is GTITLE which leaves the title as part of the graph and the graph procedures have issues with escapechar stuff sometimes.

Melk
Lapis Lazuli | Level 10
This worked, but it changes the format of my plot as well...which I don't want to change.
Melk
Lapis Lazuli | Level 10
I also noticed that it works when I do a proc print, but not when I use sgplot - so it must have to do with the graph options?
SuzanneDorinski
Lapis Lazuli | Level 10

Try using the unicode value instead:

 

  title "My Plot: Volume(ml^{unicode '00b2'x})";
huph
Calcite | Level 5

That was my solution - which works in the pdf and rtf files. However the png graphics file only shows an empty rectangle where subscript 2 should be in the label for y-axis of an sgplot plot - a pity. How to fix?

Ksharp
Super User
data sganno;
length label $ 200;
 drawspace="graphpercent"; function="text"; textweight="normal"; textsize=12;textcolor="black"; width=200;
/* x1=50; y1=2.5;label="&label1."; output;*/
 x1=50;  y1=95; label="Title -- My Plot: (ml(*ESC*){sup '2'})"; output;
 x1=2.5;  y1=50;rotate=90;label="My Plot: (ml(*ESC*){sup '2'})"; output;
 run;

title;
ods graphics/reset=all;
proc sgplot data=sashelp.class noautolegend sganno=sganno pad=(top=1cm);
scatter x=weight y=height;
yaxis label=' ';
run;
quit;

Ksharp_0-1689161920708.png

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 12 replies
  • 4188 views
  • 1 like
  • 6 in conversation