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.

### See also

Directives: `FACTOR`

, `TEXT`

, `VARIATE`

.

Commands for: Data structures.

### Example

" Example ANOV-1: one-way analysis of variance" " This experiment studied the effect of different additives on the octane level of gasoline. There were 5 additives and 4 observations on each (P.W.M. John, Statistical Design and Analysis of Experiments, page 46). Define number of units in the experiment (5 types x 4 observations)." UNITS [NVALUES=20] " Define a factor to indicate the type of gasoline for each observation." FACTOR [LABELS=!T(A,B,C,D,E)] Gasoline " Define variate to store the octane level recorded at each observation." VARIATE Octane " Read the data, representing Gasoline by its labels." READ Gasoline,Octane; FREPRESENTATION=labels A 91.7 A 91.2 A 90.9 A 90.6 B 91.7 B 91.9 B 90.9 B 90.9 C 92.4 C 91.2 C 91.6 C 91.0 D 91.8 D 92.2 D 92.0 D 91.4 E 93.1 E 92.9 E 92.4 E 92.4 : " Define the treatments to be fitted in the analysis." TREATMENTS Gasoline " Analyse the variate Octane, printing just the AOV table." ANOVA [PRINT=aov] Octane " Further output can be displayed without repeating the analysis: here we print tables of means." ADISPLAY [PRINT=means] " Example ANOV-1a: linear and quadratic contrasts" " Suppose that gasolines A-E contain 0,1,2,3,4 cc/gallon of additive, respectively (but are otherwise identical). Plot the means against the amount of additive." AGRAPH Gasoline; NEWXLEVELS=!(0,1,2,3,4) " Estimate the linear and quadratic effects of the additive." TREATMENT POL(Gasoline; 2) ANOVA [PRINT=aov,contrasts] Octane