SGPLOT Procedure

Example 10: Creating a Bar-Line Chart

Features:

VBAR statement

VLINE statement

Sample library member: SGPLBAR
Note: You can also combine the HBAR and HLINE statements to create a horizontal bar-line chart.
This example creates a bar-line chart.

Output

SGPLOT BarLine Example

Program

proc sgplot data=sashelp.stocks (where=(date >= "01jan2000"d
                                 and date <= "01jan2001"d
                                 and stock = "IBM"));
   title "Stock Volume vs. Close";
   vbar date / response=volume;
   vline date / response=close y2axis;
run;
title;

Program Description

Create the Bar-line Chart.The Y2AXIS option assigns the line plot to the Y2 axis.
proc sgplot data=sashelp.stocks (where=(date >= "01jan2000"d
                                 and date <= "01jan2001"d
                                 and stock = "IBM"));
   title "Stock Volume vs. Close";
   vbar date / response=volume;
   vline date / response=close y2axis;
run;
title;