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-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
  • 4 replies
  • 1396 views
  • 0 likes
  • 4 in conversation