Friday, February 24
PS2 Poster Session 2 and Refreshments Fri, Feb 24, 5:15 PM - 6:30 PM
Conference Center AB

Side-by-Side Bar Charts for More Than One Variable on Different Scales Using SAS SGPLOT (303403)

*John Stephen Taylor, Johnson & Johnson Vision Care, Inc. 

Keywords: SAS, bar chart, side-by-side, two y-axes, multiple y-axes, SGPLOT, GROUPDISPLAY

A bar chart is a common statistical tool that presents data in the form of horizontal or vertical bars with lengths that are proportional to the values of the variable they represent. These charts can be used to make visual comparisons when analyzing categorical data. When multiple groups are available within each category, more complex comparisons can be made using bar chart variants, such as a grouped, or side-by-side, bar chart. In a grouped bar chart, the bars for each group within a category are presented side-by-side. These charts can easily be created using the SGPLOT procedure and the GROUPDISPLAY= option in SAS v9.3 or later. However, when the need arises to examine more than one variable on different scales using a side-by-side bar chart, there is no easy way to do so using SGPLOT and the GROUPDISPLAY= option. This presentation will demonstrate how to create a side-by-side bar chart for more than one variable utilizing two y-axes with the lengths of the bars for each variable being proportionally sized relative to the appropriate y-axis. This will be accomplished using some simple data manipulation techniques (e.g., SAS DATA step), SAS MACRO programming, and several additional options and statements in the SGPLOT procedure.