UNITS directive

Defines an auxiliary vector of labels and/or the length of any vector whose length is not defined when a statement needing it is executed.


Option

NVALUES = scalar
Default length for vectors


Parameter

    variate or text
Vector of labels


Description

The UNITS directive can be used to define a default length which will then be used, if necessary, for any new vectors encountered later in the job. For example, in the statements

UNITS [NVALUES=20]

TEXT Subject

VARIATE [VALUES=0,1,2,4,8] Dlev

FACTOR [LEVELS=Dlev] Drug

VARIATE Age,Response; DECIMALS=0,2

the text Subject, the factor Drug, and the variates Age and Response are all defined to be of length 20. However, the length of the variate Dlev does not need to be set by default, but is deduced to be five from the number of values that have been specified by the VALUES option.

   The READ directive will use UNITS if values are to be read into a previously undeclared vector, as will the RESTRICT directive if you use it to restrict a structure that has not yet been declared. The UNITS setting is also used by the CALCULATE directive with the EXPAND and URAND functions if their secondary argument is not specified.

   The parameter of the UNITS directive allows you to specify the units structure, which is a variate or a text whose values will then be used as labels for output from regression or time-series directives, provided the vectors in the analysis have the same length as the units structure and provided also that these vectors do not have labels associated with them already.

   The length of the units structure must match the value set by the NVALUES option if both are set. However, either one can be used to define the other. Thus, either

TEXT [VALUES=Sun,Mon,Tue,Wed,Thur,Fri,Sat] Day

UNITS Day

or

TEXT Day

UNITS [NVALUES=7] Day

would specify the default length for vectors to be seven. In the second example this default would be applied to Day too but, of course, its (seven) values would need to be read or defined in some other way before it could be used for labelling. If the type of the units structure has not been declared, UNITS will define it as a variate.

   You can cancel the effect of a UNITS statement by

UNITS [NVALUES=*]

This means that statements that require a units structure will fail, which is the situation at the start of each job in a program. Similarly, the statement

UNITS *

cancels any reference to a units structure, but retains the default length if that has already been defined.

 

Option: NVALUES.

Parameter: unnamed.