BookmarkSubscribeRSS Feed
Eva
Quartz | Level 8 Eva
Quartz | Level 8

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

4 REPLIES 4
Bill
Quartz | Level 8

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

Jay54
Meteorite | Level 14

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
Jay54
Meteorite | Level 14

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


BarLineCluster.png
GraphGuy
Meteorite | Level 14

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

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1913 views
  • 0 likes
  • 4 in conversation