Data visualization with SAS programming

Gbarline axis settings

Reply
N/A
Posts: 0

Gbarline axis settings

Hi

In Proc Gbarline Is there any way to force a line plot to use the same axis (or axis settings) as the bar plots?

I can’t do it manually since I am using a BY variable to produce many charts.

proc gbarline data= test1;
by sektor;
bar aar / discrete sumvar=col1 subgroup=_NAME_;
plot / sumvar=col1;
run;
SAS Employee
Posts: 967

Re: Gbarline axis settings

I don't think there is a way to guarantee both the left & right side use the same axis scale, without specifying the scale in an axis statement. Which, as you mention isn't really an option when you're using a "by" statement (because each by-group might need a different axis scale).

If you really-really-really want to do it, here's one way I can think of...

Rather than using a 'by statement', get a list of all the unique by-values into a data set, and then loop through that data set and each time through call a macro and pass to it what-would-be the 'by value'. The macro would subset the data (based on the passed-in parameter), and then do some calculations and pick a good axis min/max/by values would be, and hard-code them into an axis statement (each time the macro is called, and then call gbarline. You'd basically be implementing the 'by processing' manually, and also implementing the 'axis auto-scaling' manually ... which would be quite a bit of work.
Valued Guide
Posts: 632

Re: Gbarline axis settings

Another approach is to calculate the max and min Y values across the two axes within a BY group (MEANS/SUMMARY). and then merge those two values back into the plot data as unplottable points (x axis missing) for both axes.
Ask a Question
Discussion stats
  • 2 replies
  • 212 views
  • 0 likes
  • 3 in conversation