where C is the name of the constant, and E is any valid
equation.
Constants have names, generally alphanumeric strings which begin with a
letter, and are referenced by prefixing the name with a % symbol. Index
notation is only allowed to the extent of numerical indices, and not
indices representing unknowns (use functions instead). Hence, the
name is allowed (meaning constant with known
index 2), but the name is disallowed.
The first form of the syntax has the definition part following
immediately after the name part. As an alternative, for interactive
prompting of constant inputs, the second form of the syntax prompts for
the definition part from the keyboard.
The definition part, E, is any valid equation. Thus, for example,
E might consist of a simple real number, or some more complicated
formula. Whichever, the result of the equation will be a single number
and the constant will take this value until explicitly deleted or
overwritten.
Constants can be deleted by using the XC: command, and they may
also be redefined.
It is an error if an unrecognised constant is found in an equation.
For an example, suppose that y is a data-carrier with observations
. The code shown in Figure 7.1 defines the constant %sum,
initialising it to zero, and then accumulates the sum of the 's
in the %sum constant. This sum is then output. Notice that the
initialisation is strictly necessary.