BookmarkSubscribeRSS Feed
sfo
Quartz | Level 8 sfo
Quartz | Level 8

Hi,

I want to display yaxis values like 10 {superscript}0, 10 {superscript}1, 10 {superscript}2 etc .. is there a way I can put 0, 1, 2 etc as a superscript on yaxis values?

Thanks,

6 REPLIES 6
Jay54
Meteorite | Level 14

These axis tick values make sense for a log axis.  Then, equally spaced tick values can have 10**2, 10**3, etc.  For log axis use TYPE=log on the axis statement for SGPLOT.

It is a little harder to understand this for a linear axis, you likely have numbers like 100, 200, 300 to 800.  In this case, just a 10**2, 10**3 may not suffice.  Please provide more details, or attach a picture.  With SAS 9.3, you can use the SGANNO facility to make such customizations.

sfo
Quartz | Level 8 sfo
Quartz | Level 8

Thanks Sanjay,

My Yaxis is log. Attached is the picture of the graph. What I want is 10 (to the power) -2 and so on ..Yaxis.PNG

sfo
Quartz | Level 8 sfo
Quartz | Level 8

Also, forgot to mention that I am using SAS 9.2

Thanks

Jay54
Meteorite | Level 14

This looks like a simple log axis available with With SAS 9.2 SGPLOT.  Set axis TYPE=LOG, base 10 is default.  Use LOGSTYLE option:

LOGSTYLE= LOGEXPAND | LOGEXPONENT | LINEAR.  Logexpand will show you 0.1, 1, 10, 100, 1000 on the Y axis.  Log exponenet will display only the exponent - -2, -1, 0, 1, 2, 3.  With SAS 9.2, I cannot think of a way to get 10^3 like you want.

GraphGuy
Meteorite | Level 14

SFO,

I think you'll have to hard-code each axis tickmark to use the superscript characters in gplot.

Since recent versions of SAS/Graph support unicode, you can do this using the built-in superscripted characters of a font such as "arial unicode ms".  The characters and their numeric codes are described here:

Unicode subscripts and superscripts - Wikipedia, the free encyclopedia

For example, the hex code '2074'x represents a superscripted '4' and can be hard-coded as an axis tickmark as follows (this example shows how to hard-code it in the first tick mark of the y-axis):

goptions htext=3.5pct;

axis1 value=(t=1 '10' font="arial unicode ms/unicode" '2074'x);

proc gplot data=sashelp.class;
plot height*weight / vaxis=axis1;
run;

foo.png

GraphGuy
Meteorite | Level 14

Since some of the numbers you want to superscript will need a minus sign, I'll elaborate a little on that ...

The character for a superscripted 'minus' is '207b'x, and you can combine that with the superscripted number as follows:

goptions htext=3.5pct;

axis1 value=(t=1 '10' font="arial unicode ms/unicode" '207b2074'x);

proc gplot data=sashelp.class;
plot height*weight / vaxis=axis1;
run;

foo.png

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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