scale Rescale variables to a given range scale

SAS Macro Programs: scale

$Version: 1.0 (11 Nov 1997)
Michael Friendly
York University



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

Rescale variables to a given range

The scale macro rescales a set of variables in a dataset to range between a specified low and high value, for use with other procedures or macros such as faces or stars.

Method

Usage

scale is a macro program. Values must be supplied

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

   %scale(data=inputdataset, out=outputdataset, ..., )

Parameters

DATA=_LAST_
The name of the input dataset. If not specified, the most recently created dataset is used.
OUT=_DATA_
The name of the output dataset. If not specified, the new dataset is named according to the DATAn convention.
VAR=_NUMERIC_
A list of names of variables to be rescaled. The list may contain blank-separated names, or any of the short-hand forms, X1-X10, VARA--VARB, or _NUMERIC_.
COPY=
Names of variables to be copied unchanged to the output dataset.
ID=
An observation id variable, also copied to the output dataset
OUTSTAT=
Name of an output dataset to contain the min/max values
MINMAX=
optional dataset of min/vax value
LO=0
The low value of the new range foir each variable
HI=1
The high valueof the new range foir each variable.

Example

This example scales selected variables in the auto dataset to a range of 0-1.
%include macros(scale);        *-- or include in an autocall library;
%scale(data=autom,
       out=scaled,
       outstat=range,
       var = gratio  turn  rep77  rep78  price    mpg
            hroom rseat  trunk weight length displa,
       copy=clr _freq_,
       id=id);

See also

faces Faces display for multivariate data
stars Star plot for multivariate data