BookmarkSubscribeRSS Feed
chris_lampron
Fluorite | Level 6

Good afternoon,

I am currently using SAS 9.3 and I have a question about PROC SGPLOT.  I am trying to have the yaxis display values from 0 to 10 be increments of 2, followed by a value of 20 and finally a value of 100.  I am using the following code:

     proc sgplot data=test;

          scatter x=mean y=cv/markerattrs=(symbol=circlefilled);

          series x=mean y=cv2;

          yaxis values=(0 to 10 by 2 20 100);

     run;

The output shows 0 to 10, and the 20, but then the 100 is not being displayed on the axis.  The rest of the yaxis is blank.  To me, it seems that the 100 tick mark is there, it is just off the graph.

What I would like to do is compress everything between 10 and 20, then again between 20 and 100 so that I can see the values between 0 and 10 and then the values at 20 and 100 on the yaxis.  Using PROC GPLOT, I can use the axis order option and make the changes that I want.  However, for this particular program, I am using SGPLOT.  The image below shows what a yaxis would look like when I use GPLOT.

SAS Gplot Yaxis.jpg

I saw that in SAS 9.4 there is a yaxis option of RANGES that could be used, but I can't seem to find anything in SAS 9.3.

Are there any suggestions on what I could do to resolve this?

2 REPLIES 2
Jay54
Meteorite | Level 14

GPLOT is showing you a discrete axis, where the pixel distance between 10 and 20 is the same as between 20 and 100.  Your SGPLOT code will create a numeric scaled axis, where 2, 4, etc will be close together, and 100 far away.  It is possible some of the smaller values may collide, causing alternate values to get thinned.  If you do want the scaled numeric axis and see all values, set FITPOLICY=none.

 

If you really want a discerte axis like with GPLOT, then set the YAXIS TYPE=discrete, and then set the values on the axis as character values - "20" and so on.

Jay54
Meteorite | Level 14

And, following up, FITPOLICY=none may not be available with SAS 9.3.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 5702 views
  • 0 likes
  • 2 in conversation