BookmarkSubscribeRSS Feed
Leo9
Quartz | Level 8

 

 

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
Rick_SAS
SAS Super FREQ

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.

 

 

Leo9
Quartz | Level 8

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

 

Is there any solution using proc template ?

 

Rick_SAS
SAS Super FREQ

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.

DanH_sas
SAS Super FREQ

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

DanH_sas
SAS Super FREQ

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

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