turn on suggestions

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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- PROC SGPLOT Log Axis Label

Topic Options

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-17-2016 01:29 PM

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;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-17-2016 02:36 PM

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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-17-2016 03:53 PM

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

Is there any solution using proc template ?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-17-2016 04:17 PM

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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-17-2016 04:23 PM

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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-17-2016 05:49 PM

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