1. Home
  2. SCALAR directive

SCALAR directive

Declares one or more scalar data structures.

Options

VALUE = scalar Value for all the scalars; default is a missing value
MODIFY = string token Whether to modify (instead of redefining) existing structures (yes, no); default no
IPRINT = string tokens Information to be used to identify the scalars in output (identifier, extra); if this is not set, they will be identified in the standard way for each type of output

Parameters

IDENTIFIER = identifiers Identifiers of the scalars
VALUE = scalars Value for each scalar
DECIMALS = scalars Number of decimal places for printing
EXTRA = texts Extra text associated with each identifier
MINIMUM = scalars Minimum value for the contents of each structure
MAXIMUM = scalars Maximum value for the contents of each structure
DREPRESENTATION = scalars or texts Default format to use when the contents represents a date and time

Description

A scalar data structure stores a single number. The IDENTIFIER parameter lists the identifiers of the scalars that are to be declared.

Values can be assigned to the scalars by either the VALUE option or the VALUE parameter. The option defines a common value for all the structures in the declaration, while the parameter allows them each to be given a different value. If both the option and the parameter are specified, the parameter takes precedence. However, if you do not define a value explicitly for a scalar, Genstat gives it a missing value.

The DECIMALS parameter allows you to define a number of decimal places to be used by default when each symmetric matrix is printed. You can associate a text of extra annotation with each scalar using the EXTRA parameter. The MINIMUM and MAXIMUM parameters allow you to define lower and upper limits on the values in each symmetric matrix. Genstat then prints warnings if any values outside that range are allocated to the scalar. The DREPRESENTATION parameter allows a scalar or a single-valued text to be specified for each scalar to indicate that the scalar stores a date and time, and to define a format to be used for this, by default, when it is printed; details are given in the description of the PRINT directive.

If the MODIFY option is set to yes any existing attributes and values of the scalars are retained; otherwise these are lost. The IPRINT option can be set to specify how the scalars will be identified in output. If IPRINT is not set, they will be identified in whatever way is usual for the section of output concerned. For example, the PRINT directive generally uses their identifiers (although this can be changed using the IPRINT option of PRINT itself), while the ANOVA directive will print the identifier and the extra text for each y-variate.

Options: VALUE, MODIFY, IPRINT.

Parameters: IDENTIFIER, VALUE, DECIMALS, EXTRA, MINIMUM, MAXIMUM, DREPRESENTATION.

See also

Directive: VARIATE.

Commands for: Data structures.

Example

" Example 1:1.1.2 " VARIATE [NVALUES=9] IDENTIFIER=Zinc
READ STRUCTURE=Zinc
164.2 160.6 163 166 159.8 163.9 161 161.3 165.8 :
SCALAR IDENTIFIER=Zmed,Zvar
CALCULATE Zmed = MEDIAN(Zinc)
CALCULATE Zvar = VARIANCE(Zinc)
PRINT STRUCTURE=Zmed,Zvar; DECIMALS=1,2
Updated on June 18, 2019

Was this article helpful?