Data visualization with SAS programming

Grouped Bar Graph

Reply
Regular Contributor
Regular Contributor
Posts: 158

Grouped Bar Graph

Dear all,

my customer wants me to create a grouped bar graph where the is a line from one bar to the other from the top value of each group to the top value of the corresponding group of the next bar.

Does SAS offer this kind of graph?

The customer wants even a second bar graph which is also grouped but where the groups are not stacked but displayed next to each other and with a line betwwen each and a value on the line which indicates the value of the group.

Best wishes

Eva

Super Contributor
Posts: 297

Grouped Bar Graph

Eva;

For one of the best collections around showing many of the gprohical things SAS can do, including the code to do it, look here: http://www.robslink.com/SAS/Home.htm

SAS Super FREQ
Posts: 1,265

Re: Grouped Bar Graph

This will get much easier in SAS 9.3, but in the meantime you can use GTL to create any combination of bar and line you need.  If your data is organized in columns like shown in the sas program (attached), then the GTL code will allow you to create the adjascent grouped bars with overlaid lines as shown.


BarLine.png
Attachment
SAS Super FREQ
Posts: 1,265

Re: Grouped Bar Graph

Posted in reply to Sanjay_SAS

The same graph can be done using cluster groups in the SAS 9.3 SGPLOT procedure.  See attached image and code.


BarLineCluster.png
Attachment
SAS Employee
Posts: 1,024

Grouped Bar Graph

When you say "grouped bar chart", I assume you're talking about bars with several different-colored segments stacked on top of each other? 

Using traditional SAS/Graph, proc gbarline might do what you're wanting (assuming you have a fairly recent version, such as 9.2m3).  Or, if gbarline doesn't provide what you're needing, you could annotate a line on top of a proc gchart bar chart.

Here are some various examples you might find useful:

http://support.sas.com/kb/33/171.html

http://robslink.com/SAS/democd30/new_92_sas.htm#gbarline

and a few more fancy examples...

http://robslink.com/SAS/democd36/oil_blinged.htm

http://robslink.com/SAS/democd36/oil_blinged_info.htm

http://robslink.com/SAS/democd33/subprime.htm

http://robslink.com/SAS/democd33/subprime_info.htm

http://robslink.com/SAS/democd31/shoebar.htm

http://robslink.com/SAS/democd31/shoebar_info.htm

Ask a Question
Discussion stats
  • 4 replies
  • 681 views
  • 0 likes
  • 4 in conversation