Previous Page | Next Page

Producing Charts to Summarize Variables

Review of SAS Tools


PROC CHART Statements

PROC CHART <DATA=SAS-data-set > <options>;
chart-type variable(s) </options>;

PROC CHART <DATA=SAS-data-set> <options> ;

starts the CHART procedure. You can specify the following options in the PROC CHART statement:

DATA=SAS-data-set

names the SAS data set that PROC CHART uses. If you omit DATA=, then PROC CHART uses the most recently created data set.

LPI=value

specifies the proportions of PIE and STAR charts.

chart-type variable(s) < /options>;

is a chart statement where

chart-type

specifies the kind of chart and can be any of the following:

  • BLOCK

  • HBAR

  • PIE

  • VBAR

You can use any number of chart statements in one PROC CHART step. A list of options pertains to a single chart statement.
variable(s)

identifies the variables to chart (called the chart variables).

options

specifies a list of options. Not all types of chart support all options.

You can use the following options in the VBAR, HBAR, and BLOCK statements:

GROUP=variable

produces a set of bars or blocks for each value of variable.

SUBGROUP=variable

proportionally fills each block or bar with characters that represent different values of variable.

You can use the following options in the VBAR, HBAR, BLOCK, and PIE statements:
DISCRETE

creates a bar, block, or section for every value of the chart variable.

LEVELS=number-of-midpoints

specifies the number-of-midpoints. The procedure selects the midpoints.

MIDPOINTS=midpoints-list

specifies the values of the midpoints.

SUMVAR=variable

specifies the variable to use to determine the size of the bars, blocks, or sections.

TYPE=SUM|MEAN

specifies the type of chart to create, where

SUM

sums the values of the Sumvar variable in each range. Then PROC CHART uses the sums to determine the size of each bar, block, or section.

MEAN

determines the mean value of the Sumvar variable in each range. Then PROC CHART uses the means to determine the size of each bar, block, or section.

You can use the following options in the HBAR statement:
NOSTAT

suppresses the printing of the statistics that accompany the chart by default.

FREQ

requests frequency statistics.

CFREQ

requests cumulative frequency statistics.

PERCENT

requests percentage statistics.

CPERCENT

requests cumulative percentage statistics.


PROC UNIVARIATE Statements

PROC UNIVARIATE <option(s)>;
CLASS variable-1<(variable-option(s))> <variable-2<(variable-option(s))>> </option(s)>;
HISTOGRAM <variable(s)> </option(s)>;
INSET <keyword(s) > </option(s)>;
PROC UNIVARIATE option(s);

starts the UNIVARIATE procedure. You can specify the following options in the PROC UNIVARIATE statement:

DATA=SAS-data-set

names the SAS data set that PROC UNIVARIATE uses. If you omit DATA=, then PROC UNIVARIATE uses the most recently created data set.

NOPRINT

suppresses the descriptive statistics that the PROC UNIVARIATE statement creates.

CLASS variable-1<(variable-option(s))> <variable-2<(variable-option(s))>> </ option(s)>;

specifies up to two variables whose values determine the classification levels for the component histograms. Variables in a CLASS statement are referred to as class variables.

You can specify the following option(s) in the CLASS statement:

ORDER=DATA | FORMATTED | FREQ | INTERNAL

specifies the display order for the class variable values, where

DATA

orders values according to their order in the input data set.

FORMATTED

orders values by their ascending formatted values. This order depends on your operating environment.

FREQ

orders values by descending frequency count so that levels with the most observations are listed first.

INTERNAL

orders values by their unformatted values, which yields the same order as PROC SORT. This order depends on your operating environment.

HISTOGRAM <variable(s)> </option(s)>;

creates histograms and comparative histograms using high-resolution graphics for the analysis variables that are specified. If you omit variable(s) in the HISTOGRAM statement, then the procedure creates a histogram for each variable that you list in the VAR statement, or for each numeric variable in the DATA= data set if you omit a VAR statement.

You can specify the following options in the PROC UNIVARIATE statement:

CGRID=color

specifies the color for grid lines when a grid displays on the histogram.

GRID

specifies to display a grid on the histogram. Grid lines are horizontal lines that are positioned at major tick marks on the vertical axis.

HOFFSET=value

specifies the offset in percentage screen units at both ends of the horizontal axis.

GRID

specifies to display a grid on the histogram. Grid lines are horizontal lines that are positioned at major tick marks on the vertical axis.

LGRID=linetype

specifies the line type for the grid when a grid displays on the histogram. The default is a solid line.

MIDPOINTS=value(s)

determines the width of the histogram bars as the difference between consecutive midpoints. PROC UNIVARIATE uses the same value(s) for all variables. You must use evenly spaced midpoints that are listed in increasing order.

VAXIS=value(s)

specifies tick mark values for the vertical axis. Use evenly spaced values that are listed in increasing order. The first value must be zero and the last value must be greater than or equal to the height of the largest bar. You must scale the values in the same units as the bars.

VMINOR=n

specifies the number of minor tick marks between each major tick mark on the vertical axis. PROC UNIVARIATE does not label minor tick marks.

VSCALE=scale

specifies the scale of the vertical axis, where scale is

COUNT

scales the data in units of the number of observations per data unit.

PERCENT

scales the data in units of percentage of observations per data unit.

PROPORTION

scales the data in units of proportion of observations per data unit.

INSET <keyword(s)> </option(s)>;

places a box or table of summary statistics, called an inset, directly in the histogram.

You can specify the following options in the PROC UNIVARIATE statement:

keyword(s)

specifies one or more keywords that identify the information to display in the inset. PROC UNIVARIATE displays the information in the order that you request the keywords. For a complete list of keywords, see the INSET statement in SAS/GRAPH: Reference.

FORMAT=format

specifies a format for all the values in the inset. If you specify a format for a particular statistic, then this format overrides FORMAT=format.

HEADER=string

specifies the heading text where string cannot exceed 40 characters.

NOFRAME

suppresses the frame drawn around the text.

POSITION=position

determines the position of the inset. The position is a compass point keyword, a margin keyword, or a pair of coordinates (x, y). The default position is NW, which positions the inset in the upper-left (northwest) corner of the display.


GOPTIONS Statement

GOPTIONS options-list;

specifies values for graphics options. Graphics options control characteristics of the graph, such as size, colors, type fonts, fill patterns, and symbols. In addition, they affect the settings of device parameters, which are defined in the device entry. Device parameters control such characteristics as the appearance of the display, the type of output that is produced, and the destination of the output.


FORMAT Statement

FORMAT variable format-name;

enables you to display the value of a variable by using a special pattern that you specify as format-name.

Previous Page | Next Page | Top of Page