Data visualization with SAS programming

Gplot order=(0 to ? by ?)

Reply
N/A
Posts: 0

Gplot order=(0 to ? by ?)

1) How do I specify that the y-axis always starts at 0 where SAS chooses the max and interval for the order function.

2) Is it possible to specify that the y-axis starts at 0 and specify the interval and let SAS choose the max for the order function?

If the order function does not permit this is there another function that does allow me to do this?
Thank you.
SAS Super FREQ
Posts: 890

Re: Gplot order=(0 to ? by ?)

If you have SAS 9.2, you can make this specification easily using PROC SGPLOT. To make the axis start at 0 and let the procedure determine the max and intervals, just specify MIN on the proc's axis statement:

proc sgplot data=sashelp.class;
yaxis min=0;
scatter x=weight y=height;
run;
SAS Employee
Posts: 967

Re: Gplot order=(0 to ? by ?)

Since you were specifically asking about gplot, here's how to do #1 in gplot:

proc gplot data=sashelp.class;
plot height*weight / vzero;
run;

Per #2, I don't know of a way to do that. There is a request for this feature in the defects/request system, and it might help bump up the priority of adding that feature if customers call Tech Support showing their interest, and providing specific examples of the things they'd like to be able to do with this feature. Here is the defect/request number to refer to:

S0134846: PROVIDE THE ABILITY TO SPECIFY JUST START, END, OR INCREMENT ON AXIS ORDER=
Valued Guide
Posts: 2,174

Re: Gplot order=(0 to ? by ?)

I assumed everyone, just used proc sql to select the max into a macro var, to use in the order list
Valued Guide
Posts: 2,174

Re: Gplot order=(0 to ? by ?)

gets a little more sophisticated (ceil(), log) to pick a suitable multiple rounded above the max
proc sql noprint ; **** getting max number of members and time ;
select max(members) format= 8., max( time ) format= 8.
into :max_Members, :max_time
from &syslast ;
quit ;
******now convert to next log-base10 interval, and next 10 time-axis-inteval ;
%let max_time_ax = %sysfunc( ceil( &max_time /10))0;
%let max_mems_10 = %sysfunc( length( &max_members ) ) ;

the members axis was to be logbase=10
N/A
Posts: 0

Re: Gplot order=(0 to ? by ?)

Thank you.
vzero worked well.
Ask a Question
Discussion stats
  • 5 replies
  • 177 views
  • 0 likes
  • 4 in conversation