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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 990 views
  • 0 likes
  • 3 in conversation