output: New HTML driver option "bare".
[pspp] / doc / variables.texi
1 @c PSPP - a program for statistical analysis.
2 @c Copyright (C) 2017 Free Software Foundation, Inc.
3 @c Permission is granted to copy, distribute and/or modify this document
4 @c under the terms of the GNU Free Documentation License, Version 1.3
5 @c or any later version published by the Free Software Foundation;
6 @c with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
7 @c A copy of the license is included in the section entitled "GNU
8 @c Free Documentation License".
9 @c
10 @node Variable Attributes
11 @chapter Manipulating variables
12
13 The variables in the active dataset dictionary are important.  There are
14 several utility functions for examining and adjusting them.
15
16 @menu
17 * ADD VALUE LABELS::            Add value labels to variables.
18 * DELETE VARIABLES::            Delete variables.
19 * DISPLAY::                     Display information about the active dataset.
20 * FORMATS::                     Set print and write formats.
21 * LEAVE::                       Don't clear variables between cases.
22 * MISSING VALUES::              Set missing values for variables.
23 * MODIFY VARS::                 Rename, reorder, and drop variables.
24 * MRSETS::                      Add, modify, and list multiple response sets.
25 * NUMERIC::                     Create new numeric variables.
26 * PRINT FORMATS::               Set variable print formats.
27 * RENAME VARIABLES::            Rename variables.
28 * SORT VARIABLES::              Reorder variables.
29 * VALUE LABELS::                Set value labels for variables.
30 * STRING::                      Create new string variables.
31 * VARIABLE ATTRIBUTE::          Set custom attributes on variables.
32 * VARIABLE LABELS::             Set variable labels for variables.
33 * VARIABLE ALIGNMENT::          Set the alignment for display.
34 * VARIABLE WIDTH::              Set the display width.
35 * VARIABLE LEVEL::              Set the measurement level.
36 * VARIABLE ROLE::               Set the role that a variable fills in analysis.
37 * VECTOR::                      Declare an array of variables.
38 * WRITE FORMATS::               Set variable write formats.
39 @end menu
40
41 @node ADD VALUE LABELS
42 @section ADD VALUE LABELS
43 @vindex ADD VALUE LABELS
44
45 @display
46 ADD VALUE LABELS
47         /@var{var_list} @var{value} '@var{label}' [@var{value} '@var{label}']@dots{}
48 @end display
49
50 @cmd{ADD VALUE LABELS} has the same syntax and purpose as @cmd{VALUE
51 LABELS} (@pxref{VALUE LABELS}), but it does not clear value
52 labels from the variables before adding the ones specified.
53
54 @node DELETE VARIABLES
55 @section DELETE VARIABLES
56 @vindex DELETE VARIABLES
57
58 @display
59 DELETE VARIABLES @var{var_list}.
60 @end display
61
62 @cmd{DELETE VARIABLES} deletes the specified variables from the
63 dictionary.  It may not be used to delete all variables from the
64 dictionary; use @cmd{NEW FILE} to do that (@pxref{NEW FILE}).
65
66 @cmd{DELETE VARIABLES} should not be used after defining transformations
67 but before executing a procedure.  If it is used in such a context, it
68 causes the data to be read.  If it is used while @cmd{TEMPORARY} is in
69 effect, it causes the temporary transformations to become permanent.
70
71 @node DISPLAY
72 @section DISPLAY
73 @vindex DISPLAY
74
75 @display
76 DISPLAY [SORTED] NAMES [[/VARIABLES=]@var{var_list}].
77 DISPLAY [SORTED] INDEX [[/VARIABLES=]@var{var_list}].
78 DISPLAY [SORTED] LABELS [[/VARIABLES=]@var{var_list}].
79 DISPLAY [SORTED] VARIABLES [[/VARIABLES=]@var{var_list}].
80 DISPLAY [SORTED] DICTIONARY [[/VARIABLES=]@var{var_list}].
81 DISPLAY [SORTED] SCRATCH [[/VARIABLES=]@var{var_list}].
82 DISPLAY [SORTED] ATTRIBUTES [[/VARIABLES=]@var{var_list}].
83 DISPLAY [SORTED] @@ATTRIBUTES [[/VARIABLES=]@var{var_list}].
84 DISPLAY [SORTED] VECTORS.
85 @end display
86
87 @cmd{DISPLAY} displays information about the active dataset.  A variety
88 of different forms of information can be requested.
89
90 The following keywords primarily cause information about variables to
91 be displayed.  With these keywords, by default information is
92 displayed about all variable in the active dataset, in the order that
93 variables occur in the active dataset dictionary.  The @subcmd{SORTED} keyword
94 causes output to be sorted alphabetically by variable name.  The
95 @subcmd{VARIABLES} subcommand limits output to the specified variables.
96
97 @table @asis
98 @item NAMES
99 The variables' names are displayed.
100
101 @item INDEX
102 The variables' names are displayed along with a value describing their
103 position within the active dataset dictionary.
104
105 @item LABELS
106 Variable names, positions, and variable labels are displayed.
107
108 @item VARIABLES
109 Variable names, positions, print and write formats, and missing values
110 are displayed.
111
112 @item DICTIONARY
113 Variable names, positions, print and write formats, missing values,
114 variable labels, and value labels are displayed.
115
116 @item SCRATCH
117 Variable names are displayed, for scratch variables only (@pxref{Scratch
118 Variables}).
119
120 @item ATTRIBUTES
121 @itemx @@ATTRIBUTES
122 Datafile and variable attributes are displayed.
123 The first form of the command omits those attributes
124 whose names begin with @code{@@} or @code{$@@}.
125 In the second for, all datafile and variable attributes are displayed.
126 @end table
127
128 With the @code{VECTOR} keyword, @cmd{DISPLAY} lists all the currently
129 declared vectors.  If the @subcmd{SORTED} keyword is given, the vectors are
130 listed in alphabetical order; otherwise, they are listed in textual
131 order of definition within the @pspp{} syntax file.
132
133 For related commands, see @ref{DISPLAY DOCUMENTS} and @ref{DISPLAY
134 FILE LABEL}.
135
136 @node FORMATS
137 @section FORMATS
138 @vindex FORMATS
139
140 @display
141 FORMATS @var{var_list} (@var{fmt_spec}) [@var{var_list} (@var{fmt_spec})]@dots{}.
142 @end display
143
144 @cmd{FORMATS} set both print and write formats for the specified
145 variables to the specified format specification.
146 @xref{Input and Output Formats}.
147
148 Specify a list of variables followed by a format specification in
149 parentheses.  The print and write formats of the specified variables
150 will be changed.  All of the variables listed together must have
151 the same type and, for string variables, the same width.
152
153 Additional lists of variables and formats may be included following
154 the first one.
155
156 @cmd{FORMATS} takes effect immediately.  It is not affected by
157 conditional and looping structures such as @cmd{DO IF} or @cmd{LOOP}.
158
159 @node LEAVE
160 @section LEAVE
161 @vindex LEAVE
162
163 @display
164 LEAVE @var{var_list}.
165 @end display
166
167 @cmd{LEAVE} prevents the specified variables from being
168 reinitialized whenever a new case is processed.
169
170 Normally, when a data file is processed, every variable in the active
171 dataset is initialized to the system-missing value or spaces at the
172 beginning of processing for each case.  When a variable has been
173 specified on @cmd{LEAVE}, this is not the case.  Instead, that variable is
174 initialized to 0 (not system-missing) or spaces for the first case.
175 After that, it retains its value between cases.
176
177 This becomes useful for counters.  For instance, in the example below
178 the variable @code{SUM} maintains a running total of the values in the @code{ITEM}
179 variable.
180
181 @example
182 DATA LIST /ITEM 1-3.
183 COMPUTE SUM=SUM+ITEM.
184 PRINT /ITEM SUM.
185 LEAVE SUM
186 BEGIN DATA.
187 123
188 404
189 555
190 999
191 END DATA.
192 @end example
193
194 @noindent Partial output from this example:
195
196 @example
197 123   123.00
198 404   527.00
199 555  1082.00
200 999  2081.00
201 @end example
202
203 It is best to use @cmd{LEAVE} command immediately before invoking a
204 procedure command, because the left status of variables is reset by
205 certain transformations---for instance, @cmd{COMPUTE} and @cmd{IF}.
206 Left status is also reset by all procedure invocations.
207
208 @node MISSING VALUES
209 @section MISSING VALUES
210 @vindex MISSING VALUES
211
212 @display
213 MISSING VALUES @var{var_list} (@var{missing_values}).
214
215 where @var{missing_values} takes one of the following forms:
216         @var{num1}
217         @var{num1}, @var{num2}
218         @var{num1}, @var{num2}, @var{num3}
219         @var{num1} THRU @var{num2}
220         @var{num1} THRU @var{num2}, @var{num3}
221         @var{string1}
222         @var{string1}, @var{string2}
223         @var{string1}, @var{string2}, @var{string3}
224 As part of a range, @subcmd{LO} or @subcmd{LOWEST} may take the place of @var{num1};
225 @subcmd{HI} or @subcmd{HIGHEST} may take the place of @var{num2}.
226 @end display
227
228 @cmd{MISSING VALUES} sets user-missing values for numeric and string
229 variables.  Long string variables may have missing values, but
230 characters after the first 8 bytes of the missing value must be
231 spaces.
232
233 Specify a list of variables, followed by a list of their user-missing
234 values in parentheses.  Up to three discrete values may be given, or,
235 for numeric variables only, a range of values optionally accompanied by
236 a single discrete value.  Ranges may be open-ended on one end, indicated
237 through the use of the
238 keyword @subcmd{LO} or @subcmd{LOWEST} or @subcmd{HI} or @subcmd{HIGHEST}.
239
240 The @cmd{MISSING VALUES} command takes effect immediately.  It is not
241 affected by conditional and looping constructs such as @cmd{DO IF} or
242 @cmd{LOOP}.
243
244 @node MODIFY VARS
245 @section MODIFY VARS
246 @vindex MODIFY VARS
247
248 @display
249 MODIFY VARS
250         /REORDER=@{FORWARD,BACKWARD@} @{POSITIONAL,ALPHA@} (@var{var_list})@dots{}
251         /RENAME=(@var{old_names}=@var{new_names})@dots{}
252         /@{DROP,KEEP@}=@var{var_list}
253         /MAP
254 @end display
255
256 @cmd{MODIFY VARS} reorders, renames, and deletes variables in the
257 active dataset.
258
259 At least one subcommand must be specified, and no subcommand may be
260 specified more than once.  @subcmd{DROP} and @subcmd{KEEP} may not both
261 be specified.
262
263 The @subcmd{REORDER} subcommand changes the order of variables in the active
264 dataset.  Specify one or more lists of variable names in parentheses.  By
265 default, each list of variables is rearranged into the specified order.
266 To put the variables into the reverse of the specified order, put
267 keyword @subcmd{BACKWARD} before the parentheses.  To put them into alphabetical
268 order in the dictionary, specify keyword @subcmd{ALPHA} before the parentheses.
269 @subcmd{BACKWARD} and @subcmd{ALPHA} may also be combined.
270
271 To rename variables in the active dataset, specify @subcmd{RENAME}, an equals sign
272 (@samp{=}), and lists of the old variable names and new variable names
273 separated by another equals sign within parentheses.  There must be the
274 same number of old and new variable names.  Each old variable is renamed to
275 the corresponding new variable name.  Multiple parenthesized groups of
276 variables may be specified.
277
278 The @subcmd{DROP} subcommand deletes a specified list of variables
279 from the active dataset.  @cmd{MODIFY VARS} may not be used to delete
280 all variables from the dictionary; use @cmd{NEW FILE} to do that
281 (@pxref{NEW FILE}).
282
283 The @subcmd{KEEP} subcommand keeps the specified list of variables in the active
284 dataset.  Any unlisted variables are deleted from the active dataset.
285
286 @subcmd{MAP} is currently ignored.
287
288 If either @subcmd{DROP} or @subcmd{KEEP} is specified, the data is read;
289 otherwise it is not.
290
291 @cmd{MODIFY VARS} may not be specified following @cmd{TEMPORARY}
292 (@pxref{TEMPORARY}).
293
294 @node MRSETS
295 @section MRSETS
296 @vindex MRSETS
297
298 @display
299 MRSETS
300     /MDGROUP NAME=@var{name} VARIABLES=@var{var_list} VALUE=@var{value}
301      [CATEGORYLABELS=@{VARLABELS,COUNTEDVALUES@}]
302      [@{LABEL='@var{label}',LABELSOURCE=VARLABEL@}]
303
304     /MCGROUP NAME=@var{name} VARIABLES=@var{var_list} [LABEL='@var{label}']
305
306     /DELETE NAME=@{[@var{names}],ALL@}
307
308     /DISPLAY NAME=@{[@var{names}],ALL@}
309 @end display
310
311 @cmd{MRSETS} creates, modifies, deletes, and displays multiple
312 response sets.  A multiple response set is a set of variables that
313 represent multiple responses to a single survey question in one of the
314 two following ways:
315
316 @itemize @bullet
317 @item
318 A @dfn{multiple dichotomy set} is analogous to a survey question with
319 a set of checkboxes.  Each variable in the set is treated in a Boolean
320 fashion: one value (the "counted value") means that the box was
321 checked, and any other value means that it was not.
322
323 @item
324 A @dfn{multiple category set} represents a survey question where the
325 respondent is instructed to list up to @var{n} choices.  Each variable
326 represents one of the responses.
327 @end itemize
328
329 Any number of subcommands may be specified in any order.
330
331 The @subcmd{MDGROUP} subcommand creates a new multiple dichotomy set or
332 replaces an existing multiple response set.  The @subcmd{NAME},
333 @subcmd{VARIABLES}, and
334 @subcmd{VALUE} specifications are required.  The others are optional:
335
336 @itemize @bullet
337 @item
338 @var{NAME} specifies the name used in syntax for the new multiple dichotomy
339 set.  The name must begin with @samp{$}; it must otherwise follow the
340 rules for identifiers (@pxref{Tokens}).
341
342 @item
343 @subcmd{VARIABLES} specifies the variables that belong to the set.  At least
344 two variables must be specified.  The variables must be all string or
345 all numeric.
346
347 @item
348 @subcmd{VALUE} specifies the counted value.  If the variables are numeric, the
349 value must be an integer.  If the variables are strings, then the
350 value must be a string that is no longer than the shortest of the
351 variables in the set (ignoring trailing spaces).
352
353 @item
354 @subcmd{CATEGORYLABELS} optionally specifies the source of the labels for each
355 category in the set:
356
357 @itemize @minus
358 @item
359 @subcmd{VARLABELS}, the default, uses variable labels or, for variables without
360 variable labels, variable names.  @pspp{} warns if two variables have the
361 same variable label, since these categories cannot be distinguished in
362 output.
363
364 @item
365 @subcmd{COUNTEDVALUES} instead uses each variable's value label for the counted
366 value.  @pspp{} warns if two variables have the same value label for the
367 counted value or if one of the variables lacks a value label, since
368 such categories cannot be distinguished in output.
369 @end itemize
370
371 @item
372 @subcmd{LABEL} optionally specifies a label for the multiple response set.  If
373 neither @subcmd{LABEL} nor @subcmd{LABELSOURCE=VARLABEL} is specified, the set is
374 unlabeled.
375
376 @item
377 @subcmd{LABELSOURCE=VARLABEL} draws the multiple response set's label from the
378 first variable label among the variables in the set; if none of the
379 variables has a label, the name of the first variable is used.
380 @subcmd{LABELSOURCE=VARLABEL} must be used with @subcmd{CATEGORYLABELS=COUNTEDVALUES}.
381 It is mutually exclusive with @subcmd{LABEL}.
382 @end itemize
383
384 The @subcmd{MCGROUP} subcommand creates a new multiple category set or
385 replaces an existing multiple response set.  The @subcmd{NAME} and @subcmd{VARIABLES}
386 specifications are required, and @subcmd{LABEL} is optional.  Their meanings
387 are as described above in @subcmd{MDGROUP}.  @pspp{} warns if two variables in the
388 set have different value labels for a single value, since each of the
389 variables in the set should have the same possible categories.
390
391 The @subcmd{DELETE} subcommand deletes multiple response groups.  A list of
392 groups may be named within a set of required square brackets, or ALL
393 may be used to delete all groups.
394
395 The @subcmd{DISPLAY} subcommand displays information about defined multiple
396 response sets.  Its syntax is the same as the @subcmd{DELETE} subcommand.
397
398 Multiple response sets are saved to and read from system files by,
399 e.g., the @cmd{SAVE} and @cmd{GET} command.  Otherwise, multiple
400 response sets are currently used only by third party software.
401
402 @node NUMERIC
403 @section NUMERIC
404 @vindex NUMERIC
405
406 @display
407 NUMERIC @var{var_list} [(@var{fmt_spec})] [/@var{var_list} [(@var{fmt_spec})]]@dots{}
408 @end display
409
410 @cmd{NUMERIC} explicitly declares new numeric variables, optionally
411 setting their output formats.
412
413 Specify the names of the new numeric variables as @var{var_list}.  If
414 you wish to set the variables' output formats, follow their names by
415 an output format specification in parentheses (@pxref{Input and Output
416 Formats}); otherwise, the default is F8.2.
417
418 Variables created with @cmd{NUMERIC} are initialized to the
419 system-missing value.
420
421 @node PRINT FORMATS
422 @section PRINT FORMATS
423 @vindex PRINT FORMATS
424
425 @display
426 PRINT FORMATS @var{var_list} (@var{fmt_spec}) [@var{var_list} (@var{fmt_spec})]@dots{}.
427 @end display
428
429 @cmd{PRINT FORMATS} sets the print formats for the specified
430 variables to the specified format specification.
431
432 Its syntax is identical to that of @cmd{FORMATS} (@pxref{FORMATS}),
433 but @cmd{PRINT FORMATS} sets only print formats, not write formats.
434
435 @node RENAME VARIABLES
436 @section RENAME VARIABLES
437 @vindex RENAME VARIABLES
438
439 @display
440 RENAME VARIABLES (@var{old_names}=@var{new_names})@dots{} .
441 @end display
442
443 @cmd{RENAME VARIABLES} changes the names of variables in the active
444 dataset.  Specify lists of the old variable names and new
445 variable names, separated by an equals sign (@samp{=}), within
446 parentheses.  There must be the same number of old and new variable
447 names.  Each old variable is renamed to the corresponding new variable
448 name.  Multiple parenthesized groups of variables may be specified.
449 When the old and new variable names contain only a single variable name,
450 the parentheses are optional.
451
452 @cmd{RENAME VARIABLES} takes effect immediately.  It does not cause the data
453 to be read.
454
455 @cmd{RENAME VARIABLES} may not be specified following @cmd{TEMPORARY}
456 (@pxref{TEMPORARY}).
457
458 @node SORT VARIABLES
459 @section SORT VARIABLES
460 @vindex SORT VARIABLES
461
462 @display
463 SORT VARIABLES [BY]
464     (NAME | TYPE | FORMAT | LABEL | VALUES | MISSING | MEASURE
465      | ROLE | COLUMNS | ALIGNMENT | ATTRIBUTE @var{name})
466     [(D)].
467 @end display
468
469 @cmd{SORT VARIABLES} reorders the variables in the active dataset.
470 The main specification is one of the following identifiers, which
471 determines how the variables are sorted:
472
473 @table @asis
474 @item NAME
475 Sorts the variables according to their names, in a case-insensitive
476 fashion.  However, when variable names differ only in a number at the
477 end, they are sorted numerically.  For example, @code{VAR5} is sorted
478 before @code{VAR400} even though @samp{4} precedes @samp{5}.
479
480 @item TYPE
481 Sorts numeric variables before string variables, and shorter string
482 variables before longer ones.
483
484 @item FORMAT
485 Groups variables by print format; within a format, sorts narrower
486 formats before wider ones; with the same format and width, sorts fewer
487 decimal places before more decimal places.
488 @xref{FORMATS}.
489
490 @item LABEL
491 Sorts variables without a variable label before those with one.
492 @xref{VARIABLE LABELS}.
493
494 @item VALUES
495 Sorts variables without value labels before those with some.
496 @xref{VALUE LABELS}.
497
498 @item MISSING
499 Sorts variables without missing values before those with some.
500 @xref{MISSING VALUES}.
501
502 @item MEASURE
503 Sorts nominal variables first, followed by ordinal variables, followed
504 by scale variables.  @xref{VARIABLE LEVEL}.
505
506 @item ROLE
507 Groups variables according to their role.  @xref{VARIABLE ROLE}.
508
509 @item COLUMNS
510 Sorts variables in ascending display width.  @xref{VARIABLE WIDTH}.
511
512 @item ALIGNMENT
513 Sorts variables according to their alignment, first left-aligned, then
514 right-aligned, then centered.  @xref{VARIABLE ALIGNMENT}.
515
516 @item ATTRIBUTE @var{name}
517 Sorts variables according to the first value of their @var{name}
518 attribute.  Variables without attribute are sorted first.
519 @xref{VARIABLE ATTRIBUTE}.
520 @end table
521
522 Only one sort criterion can be specified.  The sort is ``stable,'' so
523 to sort on multiple criteria one may perform multiple sorts.  For
524 example, the following will sort primarily based on alignment, with
525 variables that have the same alignment ordered based on display width:
526
527 @example
528 SORT VARIABLES BY COLUMNS.
529 SORT VARIABLES BY ALIGNMENT.
530 @end example
531
532 Specify @code{(D)} to reverse the sort order.
533
534 @node VALUE LABELS
535 @section VALUE LABELS
536 @vindex VALUE LABELS
537
538 @display
539 VALUE LABELS
540         /@var{var_list} @var{value} '@var{label}' [@var{value} '@var{label}']@dots{}
541 @end display
542
543 @cmd{VALUE LABELS} allows values of
544 variables to be associated with labels.  In this way, a short value can
545 stand for a longer, more descriptive label.
546
547 Both numeric and string variables can be given labels.  For string
548 variables, the values are case-sensitive, so that, for example, a
549 capitalized value and its lowercase variant would have to be labeled
550 separately if both are present in the data.
551
552 To set up value labels for one or more variables, specify the
553 variable names after a slash (@samp{/}), followed by a list of values
554 and their associated labels, separated by spaces.
555
556 Value labels in output are normally broken into lines automatically.
557 Put @samp{\n} in a label string to force a line break at that point.
558 The label may still be broken into lines at additional points.
559
560 Before @cmd{VALUE LABELS} is executed, any existing value labels
561 are cleared from the variables specified.  Use @cmd{ADD VALUE LABELS}
562 (@pxref{ADD VALUE LABELS}) to add value labels without clearing those
563 already present.
564
565 @node STRING
566 @section STRING
567 @vindex STRING
568
569 @display
570 STRING @var{var_list} (@var{fmt_spec}) [/@var{var_list} (@var{fmt_spec})] [@dots{}].
571 @end display
572
573 @cmd{STRING} creates new string variables for use in
574 transformations.
575
576 Specify a list of names for the variable you want to create,
577 followed by the desired output format specification in
578 parentheses (@pxref{Input and Output Formats}).
579 Variable widths are
580 implicitly derived from the specified output formats.
581 The created variables will be initialized to spaces.
582
583 If you want to create several variables with  distinct
584 output formats, you can either use two or more separate @cmd{STRING} commands,
585 or you can specify further variable list and format specification pairs, each separated
586 from the previous by a slash (@samp{/}).
587
588 The following example is one way to create three string variables; Two of the
589 variables have format A24 and the other A80:
590 @example
591 STRING firstname lastname (A24) / address (A80).
592 @end example
593
594 @noindent Here is another way to achieve the same result:
595 @example
596 STRING firstname lastname (A24).
597 STRING address (A80).
598 @end example
599
600 @noindent @dots{} and here is yet another way:
601
602 @example
603 STRING firstname (A24).
604 STRING lastname (A24).
605 STRING address (A80).
606 @end example
607
608
609
610
611 @node VARIABLE ATTRIBUTE
612 @section VARIABLE ATTRIBUTE
613 @vindex VARIABLE ATTRIBUTE
614
615 @display
616 VARIABLE ATTRIBUTE
617          VARIABLES=@var{var_list}
618          ATTRIBUTE=@var{name}('@var{value}') [@var{name}('@var{value}')]@dots{}
619          ATTRIBUTE=@var{name}@b{[}@var{index}@b{]}('@var{value}') [@var{name}@b{[}@var{index}@b{]}('@var{value}')]@dots{}
620          DELETE=@var{name} [@var{name}]@dots{}
621          DELETE=@var{name}@b{[}@var{index}@b{]} [@var{name}@b{[}@var{index}@b{]}]@dots{}
622 @end display
623
624 @cmd{VARIABLE ATTRIBUTE} adds, modifies, or removes user-defined
625 attributes associated with variables in the active dataset.  Custom
626 variable attributes are not interpreted by @pspp{}, but they are saved as
627 part of system files and may be used by other software that reads
628 them.
629
630 The required @subcmd{VARIABLES} subcommand must come first.  Specify the
631 variables to which the following @subcmd{ATTRIBUTE} or @subcmd{DELETE} subcommand
632 should apply.
633
634 Use the @subcmd{ATTRIBUTE} subcommand to add or modify custom variable
635 attributes.  Specify the name of the attribute as an identifier
636 (@pxref{Tokens}), followed by the desired value, in parentheses, as a
637 quoted string.  The specified attributes are then added or modified in
638 the variables specified on @subcmd{VARIABLES}.  Attribute names that begin with
639 @code{$} are reserved for @pspp{}'s internal use, and attribute names
640 that begin with @code{@@} or @code{$@@} are not displayed by most @pspp{}
641 commands that display other attributes.  Other attribute names are not
642 treated specially.
643
644 Attributes may also be organized into arrays.  To assign to an array
645 element, add an integer array index enclosed in square brackets
646 (@code{[} and @code{]}) between the attribute name and value.  Array
647 indexes start at 1, not 0.  An attribute array that has a single
648 element (number 1) is not distinguished from a non-array attribute.
649
650 Use the @subcmd{DELETE} subcommand to delete an attribute from the variable
651 specified on @subcmd{VARIABLES}.  Specify an attribute name by itself to delete
652 an entire attribute, including all array elements for attribute
653 arrays.  Specify an attribute name followed by an array index in
654 square brackets to delete a single element of an attribute array.  In
655 the latter case, all the array elements numbered higher than the
656 deleted element are shifted down, filling the vacated position.
657
658 To associate custom attributes with the entire active dataset, instead of
659 with particular variables, use @cmd{DATAFILE ATTRIBUTE} (@pxref{DATAFILE ATTRIBUTE}) instead.
660
661 @cmd{VARIABLE ATTRIBUTE} takes effect immediately.  It is not affected
662 by conditional and looping structures such as @cmd{DO IF} or
663 @cmd{LOOP}.
664
665 @node VARIABLE LABELS
666 @section VARIABLE LABELS
667 @vindex VARIABLE LABELS
668
669 @display
670 VARIABLE LABELS
671         @var{var_list} '@var{var_label}'
672         [ /@var{var_list} '@var{var_label}']
673         .
674         .
675         .
676         [ /@var{var_list} '@var{var_label}']
677 @end display
678
679 @cmd{VARIABLE LABELS} associates explanatory names
680 with variables.  This name, called a @dfn{variable label}, is displayed by
681 statistical procedures.
682
683 To assign a variable label to a group of variables, specify a
684 list of variable names and the variable label as a string.
685 To assign different labels to different variables in the same command,
686 precede the subsequent variable list with a slash (@samp{/}).
687
688
689 @node VARIABLE ALIGNMENT
690 @section VARIABLE ALIGNMENT
691 @vindex VARIABLE ALIGNMENT
692
693 @display
694 VARIABLE ALIGNMENT
695         @var{var_list} ( LEFT | RIGHT | CENTER )
696         [ /@var{var_list} ( LEFT | RIGHT | CENTER ) ]
697         .
698         .
699         .
700         [ /@var{var_list} ( LEFT | RIGHT | CENTER ) ]
701 @end display
702
703 @cmd{VARIABLE ALIGNMENT} sets the alignment of variables for display editing
704 purposes.   This only has effect for third party software.  It does not affect
705 the display of variables in the @pspp{} output.
706
707
708
709
710 @node VARIABLE WIDTH
711 @section VARIABLE WIDTH
712 @vindex VARIABLE WIDTH
713 @display
714 VARIABLE WIDTH
715         @var{var_list} (width)
716         [ /@var{var_list} (width) ]
717         .
718         .
719         .
720         [ /@var{var_list} (width) ]
721 @end display
722
723 @cmd{VARIABLE WIDTH} sets the column width of variables for display editing
724 purposes.   This only affects third party software.  It does not affect
725 the display of variables in the @pspp{} output.
726
727
728 @node VARIABLE LEVEL
729 @section VARIABLE LEVEL
730 @vindex VARIABLE LEVEL
731 @display
732 VARIABLE LEVEL
733         @var{var_list} ( SCALE | NOMINAL | ORDINAL )
734         [ /@var{var_list} ( SCALE | NOMINAL | ORDINAL ) ]
735         .
736         .
737         .
738         [ /@var{var_list} ( SCALE | NOMINAL | ORDINAL ) ]
739 @end display
740
741 @cmd{VARIABLE LEVEL} sets the measurement level of  variables.
742 Currently, this has no effect except for certain third party software.
743
744
745 @node VARIABLE ROLE
746 @section VARIABLE ROLE
747 @vindex VARIABLE ROLE
748 @display
749 VARIABLE ROLE
750         /@var{role} @var{var_list}
751         [/@var{role} @var{var_list}]@dots{}
752 @end display
753
754 @cmd{VARIABLE ROLE} sets the intended role of a variable for use in
755 dialog boxes in graphical user interfaces.  Each @var{role} specifies
756 one of the following roles for the variables that follow it:
757
758 @table @code
759 @item INPUT
760 An input variable, such as an independent variable.
761
762 @item TARGET
763 An output variable, such as an dependent variable.
764
765 @item BOTH
766 A variable used for input and output.
767
768 @item NONE
769 No role assigned.  (This is a variable's default role.)
770
771 @item PARTITION
772 Used to break the data into groups for testing.
773
774 @item SPLIT
775 No meaning except for certain third party software.  (This role's
776 meaning is unrelated to @cmd{SPLIT FILE}.)
777 @end table
778
779 The PSPPIRE GUI does not yet use variable roles as intended.
780
781 @node VECTOR
782 @section VECTOR
783 @vindex VECTOR
784
785 @display
786 Two possible syntaxes:
787         VECTOR @var{vec_name}=@var{var_list}.
788         VECTOR @var{vec_name_list}(@var{count} [@var{format}]).
789 @end display
790
791 @cmd{VECTOR} allows a group of variables to be accessed as if they
792 were consecutive members of an array with a vector(index) notation.
793
794 To make a vector out of a set of existing variables, specify a name
795 for the vector followed by an equals sign (@samp{=}) and the variables
796 to put in the vector.  The variables must be all numeric or all
797 string, and string variables must have the same width.
798
799 To make a vector and create variables at the same time, specify one or
800 more vector names followed by a count in parentheses.  This will
801 create variables named @code{@var{vec}1} through
802 @code{@var{vec}@var{count}}.  By default, the new variables are
803 numeric with format F8.2, but an alternate format may be specified
804 inside the parentheses before or after the count and separated from it
805 by white space or a comma.  With a string format such as A8, the
806 variables will be string variables; with a numeric format, they will
807 be numeric.  Variable names including the suffixes may not exceed 64
808 characters in length, and none of the variables may exist prior to
809 @cmd{VECTOR}.
810
811 Vectors created with @cmd{VECTOR} disappear after any procedure or
812 procedure-like command is executed.  The variables contained in the
813 vectors remain, unless they are scratch variables (@pxref{Scratch
814 Variables}).
815
816 Variables within a vector may be referenced in expressions using
817 @code{vector(index)} syntax.
818
819 @node WRITE FORMATS
820 @section WRITE FORMATS
821 @vindex WRITE FORMATS
822
823 @display
824 WRITE FORMATS @var{var_list} (@var{fmt_spec}) [@var{var_list} (@var{fmt_spec})]@dots{}.
825 @end display
826
827 @cmd{WRITE FORMATS} sets the write formats for the specified variables
828 to the specified format specification.  Its syntax is identical to
829 that of @cmd{FORMATS} (@pxref{FORMATS}), but @cmd{WRITE FORMATS} sets only
830 write formats, not print formats.