BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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;
2 REPLIES 2
GraphGuy
Meteorite | Level 14
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.
ArtC
Rhodochrosite | Level 12
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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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