Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- Graphics
- /
- PROC SGPLOT Log Axis Label

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 08-17-2016 01:29 PM
(3007 views)

I am creating a plot where the y-axis is log axis. I am using SAS 9.4 M2.

The plot which is getting produced has 1E1, 1E2, 1E3, etc as labels.

Can this be changed ? I would like to have labels like 0, 10, 100, 1000, 10000,etc

Here is the sample code :

proc sgplot data = lb;

series x = weeks y = lbstresn / group = subjid groupms=subjid markers;

yaxis label = "Genomes" type = log logstyle = logexpand logvtype = exponent display = all min = 1 max = 10;

xaxis values= (0 to 20 by 1 ) label = "Weeks" ;

run;

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Did you notice that you will get integers if MAX=5, but you get scientific notation if MAX=6 or more?

I don't know how to do what you want in SAS 9.4m2. In SAS 9.4m3 you can use the VALUESFORMAT= option to assign the format for the YAXIS. The default format is BEST6., which is why you are getting integers if MAX<=5, but you get scientific notation if MAX>=6.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

You are right. It doesn't work with higher values.

Is there any solution using proc template ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Same answer: You can use the TICKVALUEFORMAT= suboption on the YAXISOPTS= option, but that is a 9.4m3 feature.

For some data you could work around the problem by rescaling your Y variable. For example, if the Y axis shows a measurement in centimeters, you can divide the number by 1E5 and display the data as measured in meters. I don't know what your Y variable represents, but if you can divide it by 1E5 or 1E6, then you can get the integer units you want.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Actually, the VALUESFORMAT option is available in SGPLOT for any 9.4 version of SGPLOT and SGPANEL. In 9.3, is was called TICKVALUEFORMAT (like in GTL).

Thanks!

Dan

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

My apologies, Rick is correct. For LOG axes, this option had no effect until 9.4m3. Previous to that, the option affected only LINEAR and TIME axes.

Thanks!

Dan

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!

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.