gensym Macro to generate SYMBOL statement for each GROUP gensym

Visualizing Categorical Data: gensym

$Version: 1.2 (19 Jul 2001)
Michael Friendly
York University

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

Macro to generate SYMBOL statement for each GROUP

The GENSYM macro generates a series of SYMBOL statements for multiple group plots of the form

  proc gplot;
     plot y * x = group;

Separate plot symbols, colors, line styles and interpolation options may be generated for each group.

Usage

The GENSYM macro is called with keyword parameters. All parameters have default values, but the N= parameter must usually be specified. The arguments may be listed within parentheses in any order, separated by commas. For example:

  %gensym(n=4);

The INTERP=, LINE=, SYMBOLS=, and COLORS= parameters are each lists of one or more values. If fewer than N (blank delimited) values are given, the available values are reused cyclically as needed.

Parameters

N=
The number of groups. N= symbol statements are constructed, named SYMBOL1, SYMBOL2, ..., SYMBOLN.
H=
The height of the plotting symbol. The same H= value is used for all SYMBOL statements. [Default: H=1.5]
INTERP=
List of one or more interpolation options. [Default: INTERP=NONE]
LINE=
List of one or more numbers in the range 1..46 giving SAS/GRAPH line styles [Default: LINE=1]
SYMBOLS=
A list of one or more names of SAS/GRAPH plotting symbols. [Default: SYMBOLS=%STR(SQUARE TRIANGLE : $ = X _ Y)]
COLORS=
A list of one or more names of SAS/GRAPH colors. [Default: COLORS=BLACK RED GREEN BLUE BROWN YELLOW ORANGE PURPLE]

Example

To plot the four combinations of age group (old, young) and sex, with separate plotting symbols (circle, dot) for old vs. young, and separate colors (red, blue) for females vs. males, use the macro as follows:
  proc gplot;
     plot y * x = agesex;
     %gensym(n=4, symbols=circle circle dot dot, colors=red blue,
        interp=rl);

See also

gensymMacro to generate PATTERN statements
meanplot
scatmat

[Previous] [Next] [Up] [Contents] [Search]
Previous: gdispla Next: goodfit Up: Appendix A Top: index.html