I'm looking to plot two separate variables on the same bar graph. I am currently using proc gbarline to plot one of the variables, but I'd like another to be displayed next to it as another bar (not a line - essentially another "sumvar" statement). Is this possible, or is there another way/procedure that will perform this? Thanks!
FYI - The data is complicated enough that I am also plotting by subgroups and it cannot be transposed to create just one variable to graph.
If you have SAS 9.2 or higher, you can do this using GTL. Here is an example from a previous post. Please post your graph and data so I can send you something closer to what you want.
Gbarline supports subgrouped bars (stacked segments), but not grouped bars (side-by-side).
One possible work-around is to use Gchart to create the bar chart, and then use annotate
to draw the line. Here's an example:
Thank you for the information, but it's not quite what I'm looking for. I'm not actually wanting to put a line on the bar graph, I'm wanting to just make a bar graph that looks like the one you just posted (without the line) - but with two different variables. I do not have a "type" that both the variables I want to plot are under; they are each their own and must be plotted separately. Because I also need to plot by subgroups, transposing the data to put them under one heading is not possible. Can I simply combine two different bar graphs?
Hmm ... well, if you don't want a line, then you definitely don't want to be using Proc GBarline
You can combine 2 bar charts with Proc GReplay ... but I don't think the results would be what you're wanting.
Could you possibly post up some example data?
And, better yet, maybe "draw" a picture of the graph you're wanting (scan in a hand-drawn graph, or use a drawing package, or something) to show us what you're wanting?
Which release of SAS are you using? With SAS 9.2, you can easily combine multiple bar charts in one graph using GTL, with or without the line.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.