Labelling without the Hassle: How to Produce Labeled Stacked Bar Charts Using SGPLOT and GTL Without Annotate

J. Matise
Abstract:PROC SGPLOT and GTL are two powerful weapons in a SAS developer’s arsenal in producing high quality graphics. However, there are many times where you try to produce a graph and find that an option isn’t available for exactly what you want to do. Stacked bar charts, and similarly 100% stacked bar charts, are a popular method for displaying data with multiple logical groupings. SAS has made producing these charts easy in SGPLOT with the addition of the grouptype=stacked option; adding labels to the charts, however, is a more difficult task, as bar charts only support a single label per bar. While the annotation facility is one possible method for accomplishing this task, users may find it difficult to use for a variety of reasons. In the case of the clustered stacked bar chart, they may find it nearly impossible. We present two different methods for producing these charts, one using GTL and one using SGPLOT, which do not require the use of the annotation facility, and are extremely flexible. We also direct the reader to additional resources, where similar approaches to other graphical problems often are possible. This paper assumes the reader has familiarity with the basics of SAS ODS Graphics (SGPLOT in particular). Additionally, some sections assume familiarity with the Graph Template Language which underlies much of the SAS ODS Graphics system. The concepts presented require SAS 9.3 or newer to implement.
Engineering,Computer Science
What problem does this paper attempt to address?