||stars - Star plot of multivariate data
SAS Macro Programs: stars
$Version: 1.7 (21 Dec 2005)
The STARS macro draws a star plot of the multivariate observations
in a data set, as described in "Section
8.4". Each observation is depicted by a star-shaped figure
with one ray for each variable, whose length is proportional to the
size of that variable.
Each variable is scaled from 0 to 1. The STD= option permits the
variables to be standardized to a given mean and standard deviation
before this scaling. The SORTBY= option allows the observations
to be sorted by a variable or a statistic. The VORDER= option
allows the order of variables around the star to be rearranged
according to their values on a given principal component.
Observations with missing values can be assigned a default ray length
or deleted from the stars plot.
- Name of the data set to be displayed.
- List of variables, in the order to be
placed around the star, starting from angle=0
(horizontal), and proceeding counterclockwise.
- Character observation identifier variable
- Standardizes the variables first to given mean
and (optionally) a given standard deviation.
STD=0 standardizes to mean=0; STD=0 1 standardizes
to mean=0, std=1.
- Sorts the observations by a variable in the
data set, or a statistic calculated across all
variables in the VAR= list. If the SORTBY=
value end in a '.', it is assumed to be the name
of a statistic. For example SORTBY=SUM. sorts
by the total of scaled values for all variables.
- If VORDER=PRINn, the order of the VAR= variables
is rearranged according to the values of the n-th
principal component. VORDER=PRIN1 is often a good
- Minimum ray length, 0<=MINRAY<1.
- Number of stars across a page.
- Number of stars down a page. If the
product of ACROSS and DOWN is less than the
number of observations, multiple graphs are
- Specifies the color used to draw individual
observations, either as a quoted string constant, or the name of
a variable in the input data set (but don't use COLOR=COLOR !).
- Specifies the ray length to be used when an
observation has a missing value. Specify MISSING = . (a period)
to have observations with missing values deleted.
The font used for text labels is controled by the FTEXT= setting.
The HSIZE= and VSIZE= options should be used to scale the graph
so that the individual stars are approxmately the same height
%include macros(stars) ;
length clr $8;
price = -price; /* change signs so that large */
turn = -turn; /* values represent 'good' cars*/
when ('A') clr='RED ';
when ('E') clr='BLUE ';
when ('J') clr='GREEN ';
var = gratio turn rep77 rep78 price mpg
hroom rseat trunk weight length displa,
across=6, down=6, color=clr