Next: varnames() Up: MacAnova Help File Previous: user_fun   Contents


Keywords: syntax, variables, character variables, logical variables, null variables
Data are stored in named "variables" with names up to 12 characters

Names are case sensitive (for example, 'residuals' is a different name
from 'Residuals').  You should avoid names in all capital letters (for
example 'RESIDUALS') because MacAnova uses some such names for special

You should normally select names that are relevant to the problem such
as 'weight', 'residuals', or 'depv'.

Variables can be permanent (the variable remains accessible until you
delete it) or temporary (the variable is automatically deleted at the
next prompt).  Temporary variables are particularly useful in macros.
See topics macro() and 'macros'.

Permanent variables have names that begin with a letter (a-z or A-Z) or
the character '_', followed by 0 or more letters, numerals or '_'.  For
example 'x12a' and 'time_of_day' are names of permanent variables.  The
use of variable names that start with '_' can lead to confusion since
the variable is then "invisible" (see below).

Temporary variables have names that start with '@' followed by a letter
or '_' and 0 or more letters, numerals or '_'.  Examples are '@x1a' and
'@_Result.  A variable whose name starts with '@_' is "invisible".  All
temporary variables are automatically deleted each time a prompt is

"Invisible" variables have names that begin with '_' or '@_'.  They
differ from "visible" variables in two ways.  (i) Commands list() and
listbrief() ignore invisible variables unless 'invis:T' is an argument
(see listbrief(), list()); and (ii) typing an invisible variable's name
does not result in the variable's value being printed.

A few variables are "special" and have non-standard properties.
Currently CLIPBOARD, GRAPHWINDOWS and SELECTION (Motif only) are the
only "special" variables.  See topics 'CLIPBOARD' and 'GRAPHWINDOWS' for

Locked variables are variables that cannot be deleted or assigned to.
You can mark variables as being 'locked' using lockvars().  You can
unlock locked variables using unlockvars() and delete them using keyword
phrase 'lockedok:T' on delete().

When you save your workspace (see save()), the locked status of each
variable is retained so that when you restore the workspace (see
restore()) a locked variable is still locked.  However, locking a
variable does not protect it from being destroyed by restore().

One situation when locking a variable might be helpful is when you have
computed a valuable result that took a long time and you want to make
sure you don't destroy it accidentally.

You cannot lock temporary variables or "special" variables.

                           Types of Variables
There are several types of variables, including REAL, LOGICAL,
LOGICAL, CHARACTER, and STRUCTURE are abbreviated as LOGIC, CHAR, and
STRUC, respectively.

Variables of type LONG can be created by function asLong() but they
exist only transiently, being "coerced" to equivalent REAL variables
when assigned.  See asLong().

A REAL variable contains numerical data or the special value MISSING.  A
LOGICAL variable contains data with values limited to True, False or
MISSING (see 'logic').  A CHARACTER variable contains data consisting of
character information.  A LONG variable contains integer values between
-2147483647 and +2147483647 = 2^31 - 1.

REAL, LOGICAL, CHARACTER or LONG variables may be scalars (consist of a
single data item; see 'scalars'), vectors (several data items indexed by
a single subscript; see 'vectors'), matrices (data items indexed by two
subscripts; see 'matrices'), or arrays (data items indexed by more than
two subscripts; see 'arrays').  See also topic 'subscripts'.

A GRAPH variable encapsulates all the information needed to draw a
graph.  See topic 'graphs'.

A STRUCTURE variable or simply a structure consists of named components
of data which may be of any type, including STRUCTURE.  See topic

A MACRO variable or simply a macro contains one or more MacAnova
commands to be executed together.  See topics 'macros', 'macro_syntax',

A NULL variable contains no data of any sort.  See topic 'NULL'.

You can attach descriptive notes to variables, including GRAPH variables
and macros.  See topics 'notes', attachnotes(), appendnotes(),
getnotes(), and hasnotes().

                           Coordinate Labels
REAL, LOGICAL and CHARACTER variables may have vectors of labels for
each coordinate.  In particular matrices may have row and column labels.
A structure may have labels for each component.  Labels propagate
through operations and functions in a fairly sensible way.  Labels are
primarily used in output .  See topic 'labels' for details.

Gary Oehlert 2003-01-15