SERIES Call

CALL SERIES (x,y <*>GROUP=GroupVector <*>OPTION=SeriesOption <*>GRID={"X" <,"Y">} <*>LABEL={XLabel <,YLabel>} <*>XVALUES=xValues<*>YVALUES=yValues<*>PROCOPT=ProcOption<*>OTHER=Stmts ) ;

The SERIES subroutine displays a SERIES plot by calling the SGPLOT procedure. The arguments x and y are vectors that contain the data to plot. The SERIES subroutine is not a comprehensive interface to the SGPLOT procedure. It is intended for creating simple line plots for exploratory data analysis. The ODS statistical graphics subroutines are described in Chapter 15: Statistical Graphics.

A simple example follows:

x = do(-5, 5, 0.25);
y = x/5 + sin(x);

title "Series Plot with Default Properties";
run Series(x, y);

Figure 24.363: A Series Plot


Specify the x vector inside parentheses and specify all options outside the parentheses. Use the global TITLE and FOOTNOTE statements to specify titles and footnotes. Each option corresponds to a statement or option in the SGPLOT procedure.

The SERIES subroutine also supports the following options. The BAR subroutine documents these options and gives an example of their usage.

GRID=

specifies whetherto display grid lines for the X or Y axis.

LABEL=

specifies axis labels for the X or Y axis.

XVALUES=

specifies a vector of values for ticks for the X axis.

YVALUES=

specifies a vector of values for ticks for the Y axis.

PROCOPT=

specifies options in the PROC SGPLOT statement.

OTHER=

specifies statements in the SGPLOT procedure.

In addition, you can use the OPTION= option to specify a character matrix or string literal. The value is used verbatim to specify options in the SERIES statement.

The following example creates several series plots with various options. Each series plot is documented in the program comments.

/* assign a group to each observation */
x = do(-5, 5, 0.1);
y1 = pdf("Normal", x, 0, 1);
y2 = pdf("Normal", x, 0, 1.5);
g = repeat({1,2}, 1, ncol(x));
x = x  || x ;
y = y1 || y2;

title "Series Plot with Groups and Reference Lines";
/* 1. Use the GROUP= option to assign a group to each observation
 * 2. Use the OTHER= option to add reference lines to the X axis
 */
call Series(x, y) group=g                 /* assign color/marker shape */
                  other="refline -2 2 / axis=x"; /* add reference line */

Figure 24.364: Group Attributes and Reference Lines


title "Series Plot with Axis Options";
/* 1. Use the OPTION= option to display markers
 * 2. Use the GRID= option to add a reference grid
 * 3. Use the LABEL= option to specify axis labels
 * 4. Use the XVALUES= and YVALUES= options to specify tick positions
 */
x = do(-5, 5, 0.25);
y = x/5 + 2*sin(x);
call Series(x,y) option="markers"
                 grid= {X Y}
                 label={"My X Value" "My Y Value"}
                 xvalues = -4:4
                 yvalues = do(-2,2,0.5);

Figure 24.365: Marker and Axis Attributes