sieveplot Macro program for sieve diagrams sieveplot

Visualizing Categorical Data: sieveplot

$Version: 1.0 (27 May 2004)
Michael Friendly
York University

The sieveplot macro ( [download] get sieveplot.sas)

Macro program for sieve diagrams

The SIEVEPLOT macro provides a more convenient macro interface to the SAS/IML modules for sieve diagrams, so that you can input a SAS data set (in frequency form), rather than constructing the arrays used by the IML modules. It also provides the means to produce multiple sieve plots for two-way tables stratified by other BY= variables.

Method

The macro uses SAS/IML to read an n-way frequency table, and calls the sieve module.

Usage

sieveplot is a macro program. Two variable names must be supplied for the VAR= parameter.

The arguments may be listed within parentheses in any order, separated by commas. For example:

  %sieveplot(data=haireye, var=Eye Hair, filltype=obsp)

Parameters

DATA=
Name of input dataset [Default: DATA=_LAST_]
VAR=
Names of factor variables, including BY= variables. The first two variables are used as the rows and columns of the sieve diagram.
BY=
Specifies the names of one (or more) By variables. Partial sieve plots are produced for each combination of the levels of the BY= variables. The BY= variable(s) *must* be listed among the VAR= variables.
COUNT=
Name of the frequency variable [Default: COUNT=COUNT]
COLORS=
Colors for + and - residuals [Default: COLORS=BLUE RED]
FILLTYPE=
Specifies how each cell is filled, one of OBS, OBSP, DEV, EXL, EXP [Default: FILLTYPE=OBS] OBS: fill cells in proportion to observed frequencies 'OBSP: like OBS, but also write obs. freq. in cell 'DEV: fill in proportion to deviations from independence. 'EXL: no fill, write expected frequency in cell 'EXP: expfill, write expected frequency in cell
MARGINS=
Empty or TOTAL
HTEXT=
Height of text labels [Default: HTEXT=1.5]
FONT=
Font for text labels
TITLE=
Title for plot(s)
GOUT=
The name of the graphics catalog
NAME=
The name of the graph in the graphic catalog

Example

%include macros(sieveplot);        *-- or include in an autocall library;

  *-- Three way table, Hair color x Eye color x Sex;
  %include catdata(hairdat3);

  *-- Separate plots for males and females;
  %sieveplot(data=haireye, var=Eye Hair Sex, by=Sex, title=Hair-Eye data--,
      filltype=obsp);
Produces:
  *-- Collapse the table over Sex;
  %table(data=haireye, var=Eye Hair, order=data,
       weight=count, out=haireye2);

  %sieveplot(data=haireye2, var=Eye Hair, filltype=obsp);
Produces:

See also

mosaic Macro interface for mosaic displays
mosaics SAS/IML programs for mosaic displays
sieve Sieve diagrams for two-way tables (IML)
table Construct a grouped frequency table, with recoding