Data visualization with SAS programming

PROC SGPLOT Log Axis Label

Reply
Contributor
Posts: 37

PROC SGPLOT Log Axis Label

 

 

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;

SAS Super FREQ
Posts: 3,408

Re: PROC SGPLOT Log Axis Label

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.

 

 

Contributor
Posts: 37

Re: PROC SGPLOT Log Axis Label

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

 

Is there any solution using proc template ?

 

SAS Super FREQ
Posts: 3,408

Re: PROC SGPLOT Log Axis Label

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.

SAS Super FREQ
Posts: 889

Re: PROC SGPLOT Log Axis Label

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

SAS Super FREQ
Posts: 889

Re: PROC SGPLOT Log Axis Label

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

Ask a Question
Discussion stats
  • 5 replies
  • 356 views
  • 0 likes
  • 3 in conversation