The SAS Output Delivery System and reporting techniques

Proc Gplot

Not applicable
Posts: 0

Proc Gplot

Hello -

I was wondering if there was a way to control the vertical axis when you are using a by statement in Proc Gplot. I know you can use Axis1 Order = (value1 to value2 by value3) but if the values are significantly different for each by group then this won't work. Any ideas?
Super Contributor
Posts: 297

Re: Proc Gplot

Posted in reply to deleted_user
Your question isn't clear to me. The axis statement will work if you have included the full range of data for all by levels. I'm guessing though that you might want a different axis statement for each by level. I've done that with some macro statements around the plot procedure, e.g. (a snippet from somewhere to show you the principle)

%Macro ByAxis;

%do prd= 1 %to 2 %by 1;

%if &prd=1 %then %do;%let Prod=' HR';%let max=3; %let incr=2;%end;
%else %if &prd=2 %then %do;%let Prod='CR'; %let max=6; %let incr=2;%end;

axis1 order=(0 to &max by &incr)

proc gchart data=prodannual (where=(Product=&Prod));
by product;
vbar period/sumvar=pct


%Mend ByAxis;


But I have to ask - from a best practice data visualization perspective ...

If there is any intent to compare the by groups, they should all use the same scales on the graphs so that the relative position of the points/lines is immediately evident without having to interpet scale differences.
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation