Improve description.
[pspp] / spv-file-format.texi
1 @node SPSS Viewer File Format
2 @chapter SPSS Viewer File Format
3
4 SPSS Viewer or @file{.spv} files, here called SPV files, are written
5 by SPSS 16 and later to represent the contents of its output editor.
6 This chapter documents the format, based on examination of a corpus of
7 about 500 files from a variety of sources.  This description is
8 detailed enough to read SPV files, but probably not enough to write
9 them.
10
11 SPSS 15 and earlier versions use a completely different output format
12 based on the Microsoft Compound Document Format.  This format is not
13 documented here.
14
15 An SPV file is a Zip archive that can be read with @command{zipinfo}
16 and @command{unzip} and similar programs.  The final member in the Zip
17 archive is a file named @file{META-INF/MANIFEST.MF}.  This structure
18 makes SPV files resemble Java ``JAR'' files (and ODF files), but
19 whereas a JAR manifest contains a sequence of colon-delimited
20 key/value pairs, an SPV manifest contains the string
21 @samp{allowPivoting=true}, without a new-line.  (This string may be
22 the best way to identify an SPV file; it is invariant across the
23 corpus.)
24
25 The rest of the members in an SPV file's Zip archive fall into two
26 categories: @dfn{structure} and @dfn{detail} members.  Structure
27 member names begin with @file{outputViewer@var{nnnnnnnnnn}}, where
28 each @var{n} is a decimal digit, and end with @file{.xml}, and often
29 include the string @file{_heading} in between.  Each of these members
30 represents some kind of output item (a table, a heading, a block of
31 text, etc.) or a group of them.  The member whose output goes at the
32 beginning of the document is numbered 0, the next member in the output
33 is numbered 1, and so on.
34
35 Structure members contain XML.  This XML is sometimes self-contained,
36 but it often references detail members in the Zip archive, which are
37 named as follows:
38
39 @table @asis
40 @item @file{@var{prefix}_table.xml} and @file{@var{prefix}_tableData.bin}
41 @itemx @file{@var{prefix}_lightTableData.bin}
42 The structure of a table plus its data.  Older SPV files pair a
43 @file{@var{prefix}_table.xml} file that describes the table's
44 structure with a binary @file{@var{prefix}_tableData.bin} file that
45 gives its data.  Newer SPV files (the majority of those in the corpus)
46 instead include a single @file{@var{prefix}_lightTableData.bin} file
47 that incorporates both into a single binary format.
48
49 @item @file{@var{prefix}_warning.xml} and @file{@var{prefix}_warningData.bin}
50 @itemx @file{@var{prefix}_lightWarningData.bin}
51 Same format used for tables, with a different name.
52
53 @item @file{@var{prefix}_notes.xml} and @file{@var{prefix}_notesData.bin}
54 @itemx @file{@var{prefix}_lightNotesData.bin}
55 Same format used for tables, with a different name.
56
57 @item @file{@var{prefix}_chartData.bin} and @file{@var{prefix}_chart.xml}
58 The structure of a chart plus its data.  Charts do not have a
59 ``light'' format.
60
61 @item @file{@var{prefix}_pmml.scf}
62 @itemx @file{@var{prefix}_stats.scf}
63 @item @file{@var{prefix}_model.xml}
64 Not yet investigated.  The corpus contains few examples.
65 @end table
66
67 The @file{@var{prefix}} in the names of the detail members is
68 typically an 11-digit decimal number that increases for each item,
69 tending to skip values.  Older SPV files use different naming
70 conventions.  Structure member refer to detail members by name, and so
71 their exact names do not matter to readers as long as they are unique.
72
73 @menu
74 * SPV Structure Member Format::
75 * SPV Light Detail Member Format::
76 * SPV Legacy Detail Member Binary Format::
77 * SPV Legacy Detail Member XML Format::
78 @end menu
79
80 @node SPV Structure Member Format
81 @section Structure Member Format
82
83 Structure members' XML files claim conformance with a collection of
84 XML Schemas.  These schemas are distributed, under a nonfree license,
85 with SPSS binaries.  Fortunately, the schemas are not necessary to
86 understand the structure members.  To a degree, the schemas can even
87 be deceptive because they document elements and attributes that are
88 not in the corpus and do not document elements and attributes that are
89 commonly found there.
90
91 Structure members use a different XML namespace for each schema, but
92 these namespaces are not entirely consistent.  In some SPV files, for
93 example, the @code{viewer-tree} schema is associated with namespace
94 @indicateurl{http://xml.spss.com/spss/viewer-tree} and in others with
95 @indicateurl{http://xml.spss.com/spss/viewer/viewer-tree} (note the
96 additional @file{viewer/}).  Under either name, the schema URIs are
97 not resolvable to obtain the schemas themselves.
98
99 One may ignore all of the above in interpreting a structure member.
100 The actual XML has a simple and straightforward form that does not
101 require a reader to take schemas or namespaces into account.
102
103 The elements found in structure members are documented below.  For
104 each element, we note the possible parent elements and the element's
105 contents.  The contents are specified as pseudo-regular expressions
106 with the following conventions:
107
108 @table @asis
109 @item text
110 XML text content.
111
112 @item CDATA
113 XML CDATA content.
114
115 @item @code{element}
116 The named element.
117
118 @item (@dots{})
119 Grouping multiple elements.
120
121 @item [@var{x}]
122 An optional @var{x}.
123
124 @item @var{a} @math{|} @var{b}
125 A choice between @var{a} and @var{b}.
126
127 @item @var{x}*
128 Zero or more @var{x}.
129 @end table
130
131 @ifnottex
132 For a diagram illustrating the hierarchy of elements within an SPV
133 structure member, please refer to a PDF version of the manual.
134 @end ifnottex
135
136 @iftex
137 The following diagram shows the hierarchy of elements within an SPV
138 structure member.  Edges point from parent to child elements.
139 Unlabeled edges indicate that the child appears exactly once; edges
140 labeled with *, zero or more times; edges labeled with ?, zero or one
141 times.
142 @center @image{dev/spv-structure, 5in}
143 @end iftex
144
145 @menu
146 * SPV Structure heading Element::
147 * SPV Structure label Element::
148 * SPV Structure container Element::
149 * SPV Structure text Element (Inside @code{container})::
150 * SPV Structure html Element::
151 * SPV Structure table Element::
152 * SPV Structure tableStructure Element::
153 * SPV Structure dataPath Element::
154 * SPV Structure pageSetup Element::
155 * SPV Structure pageHeader and pageFooter Elements::
156 * SPV Structure pageParagraph Element::
157 * SPV Structure @code{text} Element (Inside @code{pageParagraph})::
158 @end menu
159
160 @node SPV Structure heading Element
161 @subsection The @code{heading} Element
162
163 Parent: Document root or @code{heading} @*
164 Contents: @code{pageSetup}? @code{label} (@code{container} @math{|} @code{heading})*
165
166 The root of a structure member is a @code{heading}, which represents a
167 section of output beginning with a title (the @code{label}) and
168 ordinarily followed by content containers or further nested
169 (sub)-sections of output.
170
171 The document root heading, only, may also contain a @code{pageSetup}
172 element.
173
174 The following attributes have been observed on both document root and
175 nested @code{heading} elements.
176
177 @defvr {Optional} creator-version
178 The version of the software that created this SPV file.  A string of
179 the form @code{xxyyzzww} represents software version xx.yy.zz.ww,
180 e.g.@: @code{21000001} is version 21.0.0.1.  Trailing pairs of zeros
181 are sometimes omitted, so that @code{21}, @code{210000}, and
182 @code{21000000} are all version 21.0.0.0 (and the corpus contains all
183 three of those forms).
184 @end defvr
185
186 @noindent
187 The following attributes have been observed on document root
188 @code{heading} elements only:
189
190 @defvr {Optional} @code{creator}
191 The directory in the file system of the software that created this SPV
192 file.
193 @end defvr
194
195 @defvr {Optional} @code{creation-date-time}
196 The date and time at which the SPV file was written, in a
197 locale-specific format, e.g.@: @code{Friday, May 16, 2014 6:47:37 PM
198 PDT} or @code{lunedì 17 marzo 2014 3.15.48 CET} or even @code{Friday,
199 December 5, 2014 5:00:19 o'clock PM EST}.
200 @end defvr
201
202 @defvr {Optional} @code{lockReader}
203 Whether a reader should be allowed to edit the output.  The possible
204 values are @code{true} and @code{false}, but the corpus only contains
205 @code{false}.
206 @end defvr
207
208 @defvr {Optional} @code{schemaLocation}
209 This is actually an XML Namespace attribute.  A reader may ignore it.
210 @end defvr
211
212 @noindent
213 The following attributes have been observed only on nested
214 @code{heading} elements:
215
216 @defvr {Required} @code{commandName}
217 The locale-invariant name of the command that produced the output,
218 e.g.@: @code{Frequencies}, @code{T-Test}, @code{Non Par Corr}.
219 @end defvr
220
221 @defvr {Optional} @code{visibility}
222 To what degree the output represented by the element is visible.  The
223 only observed value is @code{collapsed}.
224 @end defvr
225
226 @defvr {Optional} @code{locale}
227 The locale used for output, in Windows format, which is similar to the
228 format used in Unix with the underscore replaced by a hyphen, e.g.@:
229 @code{en-US}, @code{en-GB}, @code{el-GR}, @code{sr-Cryl-RS}.
230 @end defvr
231
232 @defvr {Optional} @code{olang}
233 The output language, e.g.@: @code{en}, @code{it}, @code{es},
234 @code{de}, @code{pt-BR}.
235 @end defvr
236
237 @node SPV Structure label Element
238 @subsection The @code{label} Element
239
240 Parent: @code{heading} or @code{container} @*
241 Contents: text
242
243 Every @code{heading} and @code{container} holds a @code{label} as its
244 first child.  The root @code{heading} in a structure member always
245 contains the string ``Output''.  Otherwise, the text in @code{label}
246 describes what it labels, often by naming the statistical procedure
247 that was executed, e.g.@: ``Frequencies'' or ``T-Test''.  Labels are
248 often very generic, especially within a @code{container}, e.g.@:
249 ``Title'' or ``Warnings'' or ``Notes''.  Label text is localized
250 according to the output language, e.g.@: in Italian a frequency table
251 procedure is labeled ``Frequenze''.
252
253 The corpus contains one example of an empty label, one that contains
254 no text.
255
256 This element has no attributes.
257
258 @node SPV Structure container Element
259 @subsection The @code{container} Element
260
261 Parent: @code{heading} @*
262 Contents: @code{label} (@code{table} @math{|} @code{text})?
263
264 A @code{container} serves to label a @code{table} or a @code{text}
265 item.
266
267 This element has the following attributes.
268
269 @defvr {Required} @code{visibility}
270 Either @code{visible} or @code{hidden}, this indicates whether the
271 container's content is displayed.
272 @end defvr
273
274 @defvr {Optional} @code{text-align}
275 Presumably indicates the alignment of text within the container.  The
276 only observed value is @code{left}.  Observed with nested @code{table}
277 and @code{text} elements.
278 @end defvr
279
280 @defvr {Optional} @code{width}
281 The width of the container in the form @code{@var{n}px}, e.g.@:
282 @code{1097px}.
283 @end defvr
284
285 @node SPV Structure text Element (Inside @code{container})
286 @subsection The @code{text} Element (Inside @code{container})
287
288 Parent: @code{container} @*
289 Contents: @code{html}
290
291 This @code{text} element is nested inside a @code{container}.  There
292 is a different @code{text} element that is nested inside a
293 @code{pageParagraph}.
294
295 This element has the following attributes.
296
297 @defvr {Required} @code{type}
298 One of @code{title}, @code{log}, or @code{text}.
299 @end defvr
300
301 @defvr {Optional} @code{commandName}
302 As on the @code{heading} element.  For output not specific to a
303 command, this is simply @code{log}.  The corpus contains one example
304 of where @code{commandName} is present but set to the empty string.
305 @end defvr
306
307 @defvr {Optional} @code{creator-version}
308 As on the @code{heading} element.
309 @end defvr
310
311 @node SPV Structure html Element
312 @subsection The @code{html} Element
313
314 Parent: @code{text} @*
315 Contents: CDATA
316
317 The CDATA contains an HTML document.  In some cases, the document
318 starts with @code{<html>} and ends with @code{</html}; in others the
319 @code{html} element is implied.  Generally the HTML includes a
320 @code{head} element with a CSS stylesheet.  The HTML body often begins
321 with @code{<BR>}.  The actual content ranges from trivial to simple:
322 just discarding the CSS and tags yields readable results.
323
324 This element has the following attributes.
325
326 @defvr {Required} @code{lang}
327 This always contains @code{en} in the corpus.
328 @end defvr
329
330 @node SPV Structure table Element
331 @subsection The @code{table} Element
332
333 Parent: @code{container} @*
334 Contents: @code{tableStructure}
335
336 This element has the following attributes.
337
338 @defvr {Required} @code{commandName}
339 As on the @code{heading} element.
340 @end defvr
341
342 @defvr {Required} @code{type}
343 One of @code{table}, @code{note}, or @code{warning}.
344 @end defvr
345
346 @defvr {Required} @code{subType}
347 The locale-invariant name for the particular kind of output that this
348 table represents in the procedure.  This can be the same as
349 @code{commandName} e.g.@: @code{Frequencies}, or different, e.g.@:
350 @code{Case Processing Summary}.  Generic subtypes @code{Notes} and
351 @code{Warnings} are often used.
352 @end defvr
353
354 @defvr {Required} @code{tableId}
355 A number that uniquely identifies the table within the SPV file,
356 typically a large negative number such as @code{-4147135649387905023}.
357 @end defvr
358
359 @defvr {Optional} @code{creator-version}
360 As on the @code{heading} element.  In the corpus, this is only present
361 for version 21 and up and always includes all 8 digits.
362 @end defvr
363
364 @node SPV Structure tableStructure Element
365 @subsection The @code{tableStructure} Element
366
367 Parent: @code{table} @*
368 Contents: @code{dataPath}
369
370 This element has no attributes.
371
372 @node SPV Structure dataPath Element
373 @subsection The @code{dataPath} Element
374
375 Parent: @code{tableStructure} @*
376 Contents: text
377
378 Contains the name of the Zip member that holds the table details,
379 e.g.@: @code{0000000001437_lightTableData.bin}.
380
381 This element has no attributes.
382
383 @node SPV Structure pageSetup Element
384 @subsection The @code{pageSetup} Element
385
386 Parent: @code{heading} @*
387 Contents: @code{pageHeader} @code{pageFooter}
388
389 This element has the following attributes.
390
391 @defvr {Required} @code{initial-page-number}
392 Always @code{1}.
393 @end defvr
394
395 @defvr {Optional} @code{chart-size}
396 Always @code{as-is} or a localization (!) of it (e.g.@: @code{dimensione
397 attuale}, @code{Wie vorgegeben}).
398 @end defvr
399
400 @defvr {Optional} @code{margin-left}
401 @defvrx {Optional} @code{margin-right}
402 @defvrx {Optional} @code{margin-top}
403 @defvrx {Optional} @code{margin-bottom}
404 Margin sizes in the form @code{@var{size}in}, e.g.@: @code{0.25in}.
405 @end defvr
406
407 @defvr {Optional} @code{paper-height}
408 @defvrx {Optional} @code{paper-width}
409 Paper sizes in the form @code{@var{size}in}, e.g.@: @code{8.5in} by
410 @code{11in} for letter paper or @code{8.267in} by @code{11.692in} for
411 A4 paper.
412 @end defvr
413
414 @defvr {Optional} @code{reference-orientation}
415 Always @code{0deg}.
416 @end defvr
417
418 @defvr {Optional} @code{space-after}
419 Always @code{12pt}.
420 @end defvr
421
422 @node SPV Structure pageHeader and pageFooter Elements
423 @subsection The @code{pageHeader} and @code{pageFooter} Elements
424
425 Parent: @code{pageSetup} @*
426 Contents: @code{pageParagraph}*
427
428 This element has no attributes.
429
430 @node SPV Structure pageParagraph Element
431 @subsection The @code{pageParagraph} Element
432
433 Parent: @code{pageHeader} or @code{pageFooter} @*
434 Contents: @code{text}
435
436 Text to go at the top or bottom of a page, respectively.
437
438 This element has no attributes.
439
440 @node SPV Structure @code{text} Element (Inside @code{pageParagraph})
441 @subsection The @code{text} Element (Inside @code{pageParagraph})
442
443 Parent: @code{pageParagraph}
444 Contents: CDATA?
445
446 This @code{text} element is nested inside a @code{pageParagraph}.  There
447 is a different @code{text} element that is nested inside a
448 @code{container}.
449
450 The element is either empty, or contains CDATA that holds almost-XHTML
451 text: in the corpus, either an @code{html} or @code{p} element.  It is
452 @emph{almost}-XHTML because the @code{html} element designates the
453 default namespace as
454 @code{http://xml.spss.com/spss/viewer/viewer-tree} instead of an XHTML
455 namespace, and because the CDATA can contain substitution variables:
456 @code{&[Page]} for the page number and @code{&[PageTitle]} for the
457 page title.
458
459 Typical contents (indented for clarity):
460
461 @example
462 <html xmlns="http://xml.spss.com/spss/viewer/viewer-tree">
463     <head></head>
464     <body>
465         <p style="text-align:right; margin-top: 0">Page &[Page]</p>
466     </body>
467 </html>
468 @end example
469
470 This element has the following attributes.
471
472 @defvr {Required} @code{type}
473 Always @code{text}.
474 @end defvr
475
476 @node SPV Light Detail Member Format
477 @section Light Detail Member Format
478
479 This section describes the format of ``light'' detail @file{.bin}
480 members.  These members have a binary format which we describe here in
481 terms of a context-free grammar using the following conventions:
482
483 @table @asis
484 @item NonTerminal @result{} @dots{}
485 Nonterminals have CamelCaps names, and @result{} indicates a
486 production.  The right-hand side of a production is often broken
487 across multiple lines.  Break points are chosen for aesthetics only
488 and have no semantic significance.
489
490 @item 00, 01, @dots{}, ff.
491 A bytes with a fixed value, written as a pair of hexadecimal digits.
492
493 @item i0, i1, @dots{}, i9, i10, i11, @dots{}
494 @itemx b0, b1, @dots{}, b9, b10, b11, @dots{}
495 A 32-bit integer in little-endian or big-endian byte order,
496 respectively, with a fixed value, written in decimal, prefixed by
497 @samp{i}.
498
499 @item byte
500 A byte.
501
502 @item bool
503 A byte with value 0 or 1.
504
505 @item int16
506 @itemx be16
507 A 16-bit integer in little-endian or big-endian byte order,
508 respectively.
509
510 @item int
511 @itemx be32
512 A 32-bit integer in little-endian or big-endian byte order,
513 respectively.
514
515 @item int64
516 @itemx be64
517 A 64-bit integer in little-endian or big-endian byte order,
518 respectively.
519
520 @item double
521 A 64-bit IEEE floating-point number.
522
523 @item float
524 A 32-bit IEEE floating-point number.
525
526 @item string
527 @itemx bestring
528 A 32-bit integer, in little-endian or big-endian byte order,
529 respectively, followed by the specified number of bytes of character
530 data.  (The encoding is indicated by the Formats nonterminal.)
531
532 @item @var{x}?
533 @var{x} is optional, e.g.@: 00? is an optional zero byte.
534
535 @item @var{x}*@var{n}
536 @var{x} is repeated @var{n} times, e.g. byte*10 for ten arbitrary bytes.
537
538 @item @var{x}[@var{name}]
539 Gives @var{x} the specified @var{name}.  Names are used in textual
540 explanations.  They are also used, also bracketed, to indicate counts,
541 e.g.@: int[@t{n}] byte*[@t{n}] for a 32-bit integer followed by the
542 specified number of arbitrary bytes.
543
544 @item @var{a} @math{|} @var{b}
545 Either @var{a} or @var{b}.
546
547 @item (@var{x})
548 Parentheses are used for grouping to make precedence clear, especially
549 in the presence of @math{|}, e.g.@: in 00 (01 @math{|} 02 @math{|} 03)
550 00.
551
552 @item count(@var{x})
553 A 32-bit integer that indicates the number of bytes in @var{x},
554 followed by @var{x} itself.
555
556 @item v1(@var{x})
557 In a version 1 @file{.bin} member, @var{x}; in version 3, nothing.
558 (The @file{.bin} header indicates the version.)
559
560 @item v3(@var{x})
561 In a version 3 @file{.bin} member, @var{x}; in version 1, nothing.
562 @end table
563
564 Little-endian byte order is far more common in this format, but a few
565 pieces of the format use big-endian byte order.
566
567 A ``light'' detail member @file{.bin} consists of a number of sections
568 concatenated together, terminated by a byte 01:
569
570 @cartouche
571 @format
572 LightMember @result{}
573     Header Title
574     Caption Footnotes
575     Fonts Formats Borders PrintSettings TableSettings
576     Dimensions Data
577     01
578 @end format
579 @end cartouche
580
581 The following sections go into more detail.
582
583 @menu
584 * SPV Light Member Header::
585 * SPV Light Member Title::
586 * PSV Light Member Caption::
587 * SPV Light Member Footnotes::
588 * SPV Light Member Fonts::
589 * SPV Light Member Borders::
590 * SPV Light Member Print Settings::
591 * SPV Light Member Table Settings::
592 * SPV Light Member Formats::
593 * SPV Light Member Dimensions::
594 * SPV Light Member Categories::
595 * SPV Light Member Data::
596 * SPV Light Member Value::
597 * SPV Light Member ValueMod::
598 @end menu
599
600 @node SPV Light Member Header
601 @subsection Header
602
603 An SPV light member begins with a 39-byte header:
604
605 @cartouche
606 @format
607 Header @result{}
608     01 00
609     (i1 @math{|} i3)[@t{version}]
610     01 bool*4 int
611     int[@t{min-column-width}] int[@t{max-column-width}]
612     int[@t{min-row-height}] int[@t{max-row-height}]
613     int64[@t{table-id}]
614 @end format
615 @end cartouche
616
617 @code{version} is a version number that affects the interpretation of
618 some of the other data in the member.  We will refer to ``version 1''
619 and ``version 3'' later on and use v1(@dots{}) and v3(@dots{}) for
620 version-specific formatting (as described previously).
621
622 @code{table-id} is a binary version of the @code{tableId} attribute in
623 the structure member that refers to the detail member.  For example,
624 if @code{tableId} is @code{-4122591256483201023}, then @code{table-id}
625 would be 0xc6c99d183b300001.
626
627 The meaning of the other variable parts of the header is not known.
628
629 @node SPV Light Member Title
630 @subsection Title
631
632 @cartouche
633 @format
634 Title @result{}
635     Value[@t{title1}] 01?
636     Value[@t{c}] 01? 31
637     Value[@t{title2}] 01?
638 @end format
639 @end cartouche
640
641 The Title, which follows the Header, specifies the pivot table's title
642 twice, as @code{title1} and @code{title2}.  In the corpus, they are
643 always the same.
644
645 Whereas the Value in @code{title1} and in @code{title2} are
646 appropriate for presentation, and localized to the user's language,
647 @code{c} is in English, sometimes less specific, and sometimes less
648 well formatted.  For example, for a frequency table, @code{title1} and
649 @code{title2} name the variable and @code{c} is simply ``Frequencies''.
650
651 @node PSV Light Member Caption
652 @subsection Caption
653
654 @cartouche
655 @format
656 Caption @result{} Caption1 Caption2
657 Caption1 @result{} 31 Value @math{|} 58
658 Caption2 @result{} 31 Value @math{|} 58
659 @end format
660 @end cartouche
661
662 The Caption, if present, is shown below the table.  Caption2 is
663 normally present.  Caption1 is only rarely nonempty; it might reflect
664 user editing of the caption.
665
666 @node SPV Light Member Footnotes
667 @subsection Footnotes
668
669 @cartouche
670 @format
671 Footnotes @result{} int[@t{n}] Footnote*[@t{n}]
672 Footnote @result{} Value[@t{text}] (58 @math{|} 31 Value[@t{marker}]) byte*4
673 @end format
674 @end cartouche
675
676 Each footnote has @code{text} and an optional customer @code{marker}
677 (such as @samp{*}).
678
679 @node SPV Light Member Fonts
680 @subsection Fonts
681
682 @cartouche
683 @format
684 Fonts @result{} 00 Font*8
685 Font @result{}
686     byte[@t{index}] 31
687     string[@t{typeface}] float[@t{size}] int[@t{style}] bool[@t{underline}]
688     int[@t{halign}] int[@t{valign}]
689     string[@t{fgcolor}] string[@t{bgcolor}]
690     byte[@t{alternate}] string[@t{altfg}] string[@t{altbg}]
691     v3(int[@t{left-margin}] int[@t{right-margin}] int[@t{top-margin}] int[@t{bottom-margin}])
692 @end format
693 @end cartouche
694
695 Each Font represents the font style for a different element, in the
696 following order: title, caption, footer, corner, column
697 labels, row labels, data, and layers.
698
699 @code{index} is the 1-based index of the Font, i.e. 1 for the first
700 Font, through 8 for the final Font.
701
702 @code{typeface} is the string name of the font.  In the corpus, this
703 is @code{SansSerif} in over 99% of instances and @code{Times New
704 Roman} in the rest.
705
706 @code{size} is the size of the font, in points.  The most common size
707 in the corpus is 12 points.
708
709 @code{style} is a bit mask.  Bit 0 (with value 1) is set for bold, bit
710 1 (with value 2) is set for italic.
711
712 @code{underline} is 1 if the font is underlined, 0 otherwise.
713
714 @code{halign} specifies horizontal alignment: 0 for center, 2 for
715 left, 4 for right, 61453 for decimal, 64173 for mixed.  Mixed
716 alignment varies according to type: string data is left-justified,
717 numbers and most other formats are right-justified.
718
719 @code{valign} specifies vertical alignment: 0 for center, 1 for top, 3
720 for bottom.
721
722 @code{fgcolor} and @code{bgcolor} are the foreground color and
723 background color, respectively.  In the corpus, these are always
724 @code{#000000} and @code{#ffffff}, respectively.
725
726 @code{alternate} is 01 if rows should alternate colors, 00 if all rows
727 should be the same color.  When @code{alternate} is 01, @code{altfg}
728 and @code{altbg} specify the colors for the alternate rows.
729
730 @node SPV Light Member Borders
731 @subsection Borders
732
733 @cartouche
734 @format
735 Borders @result{}
736     b1[@t{endian}]
737     be32[@t{n-borders}] Border*[@t{n-borders}]
738     bool[@t{show-grid-lines}]
739     00 00 00
740
741 Border @result{}
742     be32[@t{border-type}]
743     be32[@t{stroke-type}]
744     be32[@t{color}]
745 @end format
746 @end cartouche
747
748 The Borders reflect how borders between regions are drawn.
749
750 The fixed value of @code{endian} can be used to validate the
751 endianness.
752
753 @code{show-grid-lines} is 1 to draw grid lines, otherwise 0.
754
755 Each Border describes one kind of border.  @code{n-borders} seems to
756 always be 19.  Each @code{border-type} appears once in order, and they
757 correspond to the following borders:
758
759 @table @asis
760 @item 0
761 Title.
762 @item 1@dots{}4
763 Left, top, right, and bottom outer frame.
764 @item 5@dots{}8
765 Left, top, right, and bottom inner frame.
766 @item 9, 10
767 Left and top of data area.
768 @item 11, 12
769 Horizontal and vertical dimension rows.
770 @item 13, 14
771 Horizontal and vertical dimension columns.
772 @item 15, 16
773 Horizontal and vertical category rows.
774 @item 17, 18
775 Horizontal and vertical category columns.
776 @end table
777
778 @code{stroke-type} describes how a border is drawn, as one of:
779
780 @table @asis
781 @item 0
782 No line.
783 @item 1
784 Solid line.
785 @item 2
786 Dashed line.
787 @item 3
788 Thick line.
789 @item 4
790 Thin line.
791 @item 5
792 Double line.
793 @end table
794
795 @code{color} is an RGB color.  Bits 24--31 are alpha, bits 16--23 are
796 red, 8--15 are green, 0--7 are blue.  An alpha of 255 indicates an
797 opaque color, therefore opaque black is 0xff000000.
798
799 @node SPV Light Member Print Settings
800 @subsection Print Settings
801
802 @cartouche
803 @format
804 PrintSettings @result{}
805     b1[@t{endian}]
806     bool[@t{layers}]
807     bool[@t{paginate-layers}]
808     bool[@t{fit-width}]
809     bool[@t{fit-length}]
810     bool[@t{top-continuation}]
811     bool[@t{bottom-continuation}]
812     be32[@t{n-orphan-lines}]
813     bestring[@t{continuation-string}]
814 @end format
815 @end cartouche
816
817 The PrintSettings reflect settings for printing.  The fixed value of
818 @code{endian} can be used to validate the endianness.
819
820 @code{layers} is 1 to print all layers, 0 to print only the visible
821 layers.
822
823 @code{paginate-layers} is 1 to print each layer at the start of a new
824 page, 0 otherwise.
825
826 @code{fit-width} and @code{fit-length} control whether the table is
827 shrunk to fit within a page's width or length, respectively.
828
829 @code{n-orphan-lines} is the minimum number of rows or columns to put
830 in one part of a table that is broken across pages.
831
832 If @code{top-continuation} is 1, then @code{continuation-string} is
833 printed at the top of a page when a table is broken across pages for
834 printing; similarly for @code{bottom-continuation} and the bottom of a
835 page.  Usually, @code{continuation-string} is empty.
836
837 @node SPV Light Member Table Settings
838 @subsection Table Settings
839
840 @cartouche
841 @format
842 TableSettings @result{}
843     be32[@t{endian}]
844     be32
845     be32[@t{current-layer}]
846     bool[@t{omit-empty}]
847     bool[@t{show-row-labels-in-corner}]
848     bool[@t{show-alphabetic-markers}]
849     bool[@t{footnote-marker-position}]
850     v3(
851       byte
852       be32[@t{n}] byte*[@t{n}]
853       bestring
854       bestring[@t{table-look}]
855       00...
856     )
857 @end format
858 @end cartouche
859
860 The TableSettings reflect display settings.  The fixed value of
861 @code{endian} can be used to validate the endianness.
862
863 @code{current-layer} is the displayed layer.
864
865 If @code{omit-empty} is 1, empty rows or columns (ones with nothing in
866 any cell) are hidden; otherwise, they are shown.
867
868 If @code{show-row-labels-in-corner} is 1, then row labels are shown in
869 the upper left corner; otherwise, they are shown nested.
870
871 If @code{show-alphabetic-markers} is 1, markers are shown as letters
872 (e.g. @samp{a}, @samp{b}, @samp{c}, @dots{}); otherwise, they are
873 shown as numbers starting from 1.
874
875 When @code{footnote-marker-position} is 1, footnote markers are shown
876 as superscripts, otherwise as subscripts.
877
878 @code{table-look} is the name of a SPSS ``TableLook'' table style,
879 such as ``Default'' or ``Academic''; it is often empty.
880
881 TableSettings ends with an arbitrary number of null bytes.
882
883 @node SPV Light Member Formats
884 @subsection Formats
885
886 @cartouche
887 @format
888 Formats @result{}
889     int[@t{n4}] int*[@t{n4}]
890     string[@t{encoding}]
891     (i0 @math{|} i-1) (00 @math{|} 01) 00 (00 @math{|} 01)
892     int
893     byte[@t{decimal}] byte[@t{grouping}]
894     int[@t{n-ccs}] string*[@t{n-ccs}]
895     v1(i0)
896     v3(count(count(X5) count(X6)))
897
898 X5 @result{} byte*33 int[@t{n}] int*[@t{n}]
899 X6 @result{}
900     01 00 (03 @math{|} 04) 00 00 00
901     string[@t{command}] string[@t{subcommand}]
902     string[@t{language}] string[@t{charset}] string[@t{locale}]
903     (00 @math{|} 01) 00 (00 @math{|} 01) (00 @math{|} 01)
904     int
905     byte[@t{decimal}] byte[@t{grouping}]
906     byte*8 01
907     (string[@t{dataset}] string[@t{data file}] i0 int i0)?
908     int[@t{n-ccs}] string*[@t{n-ccs}]
909     2e (00 @math{|} 01) (i2000000 i0)?
910 @end format
911 @end cartouche
912
913 Observed values of @code{n4} vary from 0 to 17.  Out of 7,060 examples
914 in the corpus, it is nonzero only 36 times.
915
916 @code{encoding} is a character encoding, usually a Windows code page
917 such as @code{en_US.windows-1252} or @code{it_IT.windows-1252}.  The
918 rest of the character strings in the member use this encoding.  The
919 encoding string is itself encoded in US-ASCII.
920
921 @code{decimal} is the decimal point character.  The observed values
922 are @samp{.} and @samp{,}.
923
924 @code{grouping} is the grouping character.  Usually, it is @samp{,} if
925 @code{decimal} is @samp{.}, and vice versa.  Other observed values are
926 @samp{'} (apostrophe), @samp{ } (space), and zero (presumably
927 indicating that digits should not be grouped).
928
929 @code{n-ccs} is observed as either 0 or 5.  When it is 5, the
930 following strings are CCA through CCE format strings.  @xref{Custom
931 Currency Formats,,, pspp, PSPP}.  Most commonly these are all
932 @code{-,,,} but other strings occur.
933
934 @node SPV Light Member Dimensions
935 @subsection Dimensions
936
937 A pivot table presents multidimensional data.  A Dimension identifies
938 the categories associated with each dimension.
939
940 @cartouche
941 @format
942 Dimensions @result{} int[@t{n-dims}] Dimension*[@t{n-dims}]
943 Dimension @result{} Value[@t{name}] DimUnknown int[@t{n-categories}] Category*[@t{n-categories}]
944 DimUnknown @result{}
945     byte[@t{d1}]
946     (00 @math{|} 01 @math{|} 02)[@t{d2}]
947     (i0 @math{|} i2)[@t{d3}]
948     (00 @math{|} 01)[@t{d4}]
949     (00 @math{|} 01)[@t{d5}]
950     01
951     int[@t{d6}]
952 @end format
953 @end cartouche
954
955 @code{name} is the name of the dimension, e.g. @code{Variables},
956 @code{Statistics}, or a variable name.
957
958 @code{d1} is usually 0 but many other values have been observed.
959
960 @code{d3} is 2 over 99% of the time.
961
962 @code{d5} is 0 over 99% of the time.
963
964 @code{d6} is either -1 or the 0-based index of the dimension, e.g.@: 0
965 for the first dimension, 1 for the second, and so on.  The latter is
966 the case 98% of the time in the corpus.
967
968 @node SPV Light Member Categories
969 @subsection Categories
970
971 Categories are arranged in a tree.  Only the leaf nodes in the tree
972 are really categories; the others just serve as grouping constructs.
973
974 @cartouche
975 @format
976 Category @result{} Value[@t{name}] (Leaf @math{|} Group)
977 Leaf @result{} 00 00 00 i2 int[@t{index}] i0
978 Group @result{}
979     (00 @math{|} 01)[@t{merge}] 00 01 (i0 @math{|} i2)[@t{data}]
980     i-1 int[@t{n-subcategories}] Category*[@t{n-subcategories}]
981 @end format
982 @end cartouche
983
984 @code{name} is the name of the category (or group).
985
986 A Leaf represents a leaf category.  The Leaf's @code{index} is a
987 nonnegative integer less than @code{n-categories} in the Dimension in
988 which the Category is nested (directly or indirectly).
989
990 A Group represents a Group of nested categories.  Usually a Group
991 contains at least one Category, so that @code{n-subcategories} is
992 positive, but a few Groups with @code{n-subcategories} 0 has been
993 observed.
994
995 If a Group's @code{merge} is 00, the most common value, then the group
996 is really a distinct group that should be represented as such in the
997 visual representation and user interface.  If @code{merge} is 01, the
998 categories in this group should be shown and treated as if they were
999 direct children of the group's containing group (or if it has no
1000 parent group, then direct children of the dimension), and this group's
1001 name is irrelevant and should not be displayed.  (Merged groups can be
1002 nested!)
1003
1004 A Group's @code{data} appears to be i2 when all of the categories
1005 within a group are leaf categories that directly represent data values
1006 for a variable (e.g. in a frequency table or crosstabulation, a group
1007 of values in a variable being tabulated) and i0 otherwise.
1008
1009 @node SPV Light Member Data
1010 @subsection Data
1011
1012 The final part of an SPV light member contains the actual data.
1013
1014 @cartouche
1015 @format
1016 Data @result{}
1017     int[@t{layers}] int[@t{rows}] int[@t{columns}] int*[@t{n-dimensions}]
1018     int[@t{n-data}] Datum*[@t{n-data}]
1019 Datum @result{} int64[@t{index}] v3(00?) Value
1020 @end format
1021 @end cartouche
1022
1023 The values of @code{layers}, @code{rows}, and @code{columns} each
1024 specifies the number of dimensions displayed in layers, rows, and
1025 columns, respectively.  Any of them may be zero.  Their values sum to
1026 @code{n-dimensions} from Dimensions (@pxref{SPV Light Member
1027 Dimensions}).
1028
1029 The @code{n-dimensions} integers are a permutation of the 0-based
1030 dimension numbers.  The first @code{layers} integers specify each of
1031 the dimensions represented by layers, the next @code{rows} integers
1032 specify the dimensions represented by rows, and the final
1033 @code{columns} integers specify the dimensions represented by columns.
1034 When there is more than one dimension of a given kind, the inner
1035 dimensions are given first.
1036
1037 The format of a Datum varies slightly from version 1 to version 3: in
1038 version 1 it allows for an extra optional 00 byte.
1039
1040 A Datum consists of an @code{index} and a Value.  Suppose there are
1041 @math{d} dimensions and dimension @math{i}, @math{0 \le i < d}, has
1042 @math{n_i} categories.  Consider the datum at coordinates @math{x_i},
1043 @math{0 \le i < d}, and note that @math{0 \le x_i < n_i}.  Then the
1044 index is calculated by the following algorithm:
1045
1046 @display
1047 let @i{index} = 0
1048 for each @math{i} from 0 to @math{d - 1}:
1049     @i{index} = (@math{n_i \times} @i{index}) @math{+} @math{x_i}
1050 @end display
1051
1052 For example, suppose there are 3 dimensions with 3, 4, and 5
1053 categories, respectively.  The datum at coordinates (1, 2, 3) has
1054 index @math{5 \times (4 \times (3 \times 0 + 1) + 2) + 3 = 33}.
1055
1056 @node SPV Light Member Value
1057 @subsection Value
1058
1059 Value is used throughout the SPV light member format.  It boils down
1060 to a number or a string.
1061
1062 @cartouche
1063 @format
1064 Value @result{} 00? 00? 00? 00? RawValue
1065 RawValue @result{}
1066     01 ValueMod int[@t{format}] double[@t{x}]
1067   @math{|} 02 ValueMod int[@t{format}] double[@t{x}]
1068     string[@t{varname}] string[@t{vallab}] (01 @math{|} 02 @math{|} 03)
1069   @math{|} 03 string[@t{local}] ValueMod string[@t{id}] string[@t{c}] (00 @math{|} 01)[@t{type}]
1070   @math{|} 04 ValueMod int[@t{format}] string[@t{vallab}] string[@t{varname}]
1071     (01 @math{|} 02 @math{|} 03) string[@t{s}]
1072   @math{|} 05 ValueMod string[@t{varname}] string[@t{varlabel}] (01 @math{|} 02 @math{|} 03)
1073   @math{|} ValueMod string[@t{format}] int[@t{n-args}] Argument*[@t{n-args}]
1074 Argument @result{}
1075     i0 Value
1076   @math{|} int[@t{x}] i0 Value*[@t{x}@math{+}1]      /* @t{x} @math{>} 0 */
1077 @end format
1078 @end cartouche
1079
1080 There are several possible encodings, which one can distinguish by the
1081 first nonzero byte in the encoding.
1082
1083 @table @asis
1084 @item 01
1085 The numeric value @code{x}, intended to be presented to the user
1086 formatted according to @code{format}, which is in the format described
1087 for system files.  @xref{System File Output Formats}, for details.
1088 Most commonly, @code{format} has width 40 (the maximum).
1089
1090 An @code{x} with the maximum negative double value @code{-DBL_MAX}
1091 represents the system-missing value SYSMIS.  (HIGHEST and LOWEST have
1092 not been observed.)  @xref{System File Format}, for more about these
1093 special values.
1094
1095 @item 02
1096 Similar to @code{01}, with the additional information that @code{x} is
1097 a value of variable @code{varname} and has value label @code{vallab}.
1098 Both @code{varname} and @code{vallab} can be the empty string, the
1099 latter very commonly.
1100
1101 The meaning of the final byte is unknown.  Possibly it is connected to
1102 whether the value or the label should be displayed.
1103
1104 @item 03
1105 A text string, in two forms: @code{c} is in English, and sometimes
1106 abbreviated or obscure, and @code{local} is localized to the user's
1107 locale.  In an English-language locale, the two strings are often the
1108 same, and in the cases where they differ, @code{local} is more
1109 appropriate for a user interface, e.g.@: @code{c} of ``Not a PxP table
1110 for MCN...'' versus @code{local} of ``Computed only for a PxP table,
1111 where P must be greater than 1.''
1112
1113 @code{c} and @code{local} are always either both empty or both
1114 nonempty.
1115
1116 @code{id} is a brief identifying string whose form seems to resemble a
1117 programming language identifier, e.g.@: @code{cumulative_percent} or
1118 @code{factor_14}.  It is not unique.
1119
1120 @code{type} is 00 for text taken from user input, such as syntax
1121 fragment, expressions, file names, data set names, and 01 for fixed
1122 text strings such as names of procedures or statistics.  In the former
1123 case, @code{id} is always the empty string; in the latter case,
1124 @code{id} is still sometimes empty.
1125
1126 @item 04
1127 The string value @code{s}, intended to be presented to the user
1128 formatted according to @code{format}.  The format for a string is not
1129 too interesting, and the corpus contains many clearly invalid formats
1130 like A16.39 or A255.127 or A134.1, so readers should probably ignore
1131 the format entirely.
1132
1133 @code{s} is a value of variable @code{varname} and has value label
1134 @code{vallab}.  @code{varname} is never empty but @code{vallab} is
1135 commonly empty.
1136
1137 The meaning of the final byte is unknown.
1138
1139 @item 05
1140 Variable @code{varname}, which is rarely observed as empty in the
1141 corpus, with variable label @code{varlabel}, which is often empty.
1142
1143 The meaning of the final byte is unknown.
1144
1145 @item 31 or 58
1146 (These bytes begin a ValueMod.)  A format string, analogous to
1147 @code{printf}, followed by one or more Arguments, each of which has
1148 one or more values.  The format string uses the following syntax:
1149
1150 @table @code
1151 @item \%
1152 @itemx \:
1153 @itemx \[
1154 @itemx \]
1155 Each of these expands to the character following @samp{\\}, to escape
1156 characters that have special meaning in format strings.  These are
1157 effective inside and outside the @code{[@dots{}]}  syntax forms
1158 described below.
1159
1160 @item \n
1161 Expands to a new-line, inside or outside the @code{[@dots{}]} forms
1162 described below.
1163
1164 @item ^@var{i}
1165 Expands to a formatted version of argument @var{i}, which must have
1166 only a single value.  For example, @code{^1} expands to the first
1167 argument's @code{value}.
1168
1169 @item [:@var{a}:]@var{i}
1170 Expands @var{a} for each of the values in @var{i}.  @var{a}
1171 should contain one or more @code{^@var{j}} conversions, which are
1172 drawn from the values for argument @var{i} in order.  Some examples
1173 from the corpus:
1174
1175 @table @code
1176 @item [:^1:]1
1177 All of the values for the first argument, concatenated.
1178
1179 @item [:^1\n:]1
1180 Expands to the values for the first argument, each followed by
1181 a new-line.
1182
1183 @item [:^1 = ^2:]2
1184 Expands to @code{@var{x} = @var{y}} where @var{x} is the second
1185 argument's first value and @var{y} is its second value.  (This would
1186 be used only if the argument has two values.  If there were more
1187 values, the second and third values would be directly concatenated,
1188 which would look funny.)
1189 @end table
1190
1191 @item [@var{a}:@var{b}:]@var{i}
1192 This extends the previous form so that the first values are expanded
1193 using @var{a} and later values are expanded using @var{b}.  For an
1194 unknown reason, within @var{a} the @code{^@var{j}} conversions are
1195 instead written as @code{%@var{j}}.  Some examples from the corpus:
1196
1197 @table @code
1198 @item [%1:*^1:]1
1199 Expands to all of the values for the first argument, separated by
1200 @samp{*}.
1201
1202 @item [%1 = %2:, ^1 = ^2:]1
1203 Given appropriate values for the first argument, expands to @code{X =
1204 1, Y = 2, Z = 3}.
1205
1206 @item [%1:, ^1:]1
1207 Given appropriate values, expands to @code{1, 2, 3}.
1208 @end table
1209 @end table
1210
1211 The format string is localized to the user's locale.
1212 @end table
1213
1214 @node SPV Light Member ValueMod
1215 @subsection ValueMod
1216
1217 A ValueMod can specify special modifications to a Value.
1218
1219 @cartouche
1220 @format
1221 ValueMod @result{}
1222     31 i0 (i0 @math{|} i1 string[@t{subscript}])
1223     v1(00 (i1 @math{|} i2) 00 00 int 00 00)
1224     v3(count(FormatString Style ValueModUnknown))
1225   @math{|} 31 int[@t{n-refs}] int16*[@t{n-refs}] Format
1226   @math{|} 58
1227 Style @result{} 58 @math{|} 31 01? 00? 00? 00? 01 string[@t{fgcolor}] string[@t{bgcolor}] string[@t{typeface}] byte
1228 Format @result{} 00 00 count(FormatString Style 58)
1229 FormatString @result{} count((i0 (58 @math{|} 31 string))?)
1230 ValueModUnknown @result{} 58 @math{|} 31 i0 i0 i0 i0 01 00 (01 @math{|} 02 @math{|} 08) 00 08 00 0a 00)
1231 @end format
1232 @end cartouche
1233
1234 A ValueMod that begins with ``31 i0'' specifies a string to append to
1235 the main text of the Value, as a subscript.  The subscript text is a
1236 brief indicator, e.g.@: @samp{a} or @samp{a,b}, with its meaning
1237 indicated by the table caption.  In this usage, subscripts are similar
1238 to footnotes.  One apparent difference is that a Value can only
1239 reference one footnote but a subscript can list more than one letter.
1240
1241 A ValueMod that begins with 31 followed by a nonzero ``int'' specifies
1242 a footnote or footnotes that the Value references.  Footnote markers
1243 are shown appended to the main text of the Value, as superscripts.
1244
1245 The Format, if present, is a format string for substitutions using the
1246 syntax explained previously.  It appears to be an English-language
1247 version of the localized format string in the Value in which the
1248 Format is nested.
1249
1250 The Style, if present, changes the style for this individual Value.
1251
1252 @node SPV Legacy Detail Member Binary Format
1253 @section Legacy Detail Member Binary Format
1254
1255 Whereas the light binary format represents everything about a given
1256 pivot table, the legacy binary format conceptually consists of a
1257 number of named sources, each of which consists of a number of named
1258 variables, each of which is a 1-dimensional array of numbers or
1259 strings or a mix.  Thus, the legacy binary member format is quite
1260 simple.
1261
1262 This section uses the same context-free grammar notation as in the
1263 previous section, with the following additions:
1264
1265 @table @asis
1266 @item vAF(@var{x})
1267 In a version 0xaf legacy member, @var{x}; in other versions, nothing.
1268 (The legacy member header indicates the version; see below.)
1269
1270 @item vB0(@var{x})
1271 In a version 0xb0 legacy member, @var{x}; in other versions, nothing.
1272 @end table
1273
1274 A legacy detail member @file{.bin} has the following overall format:
1275
1276 @cartouche
1277 @format
1278 LegacyBinary @result{}
1279     00 byte[@t{version}] int16[@t{n-sources}] int[@t{member-size}]
1280     Metadata*[@t{n-sources}] Data*[@t{n-sources}]
1281 @end format
1282 @end cartouche
1283
1284 @code{version} is a version number that affects the interpretation of
1285 some of the other data in the member.  Versions 0xaf and 0xb0 are
1286 known.  We will refer to ``version 0xaf'' and ``version 0xb0'' members
1287 later on.
1288
1289 A legacy member consists of @code{n-sources} data sources, each of
1290 which has Metadata and Data.
1291
1292 @code{member-size} is the size of the legacy binary member, in bytes.
1293
1294 The following sections go into more detail.
1295
1296 @menu
1297 * SPV Legacy Member Metadata::
1298 * SPV Legacy Member Data::
1299 @end menu
1300
1301 @node SPV Legacy Member Metadata
1302 @subsection Metadata
1303
1304 @cartouche
1305 @format
1306 Metadata @result{}
1307     int[@t{n-data}] int[@t{n-variables}] int[@t{offset}]
1308     vAF(byte*32[@t{source-name}])
1309     vB0(byte*64[@t{source-name}] int[@t{x}])
1310 @end format
1311 @end cartouche
1312
1313 A data source has @code{n-variables} variables, each with
1314 @code{n-data} data values.
1315
1316 @code{source-name} is a 32- or 64-byte string padded on the right with
1317 zero bytes.  The names that appear in the corpus are very generic:
1318 usually @code{tableData} for pivot table data or @code{source0} for
1319 chart data.
1320
1321 A given Metadata's @code{offset} is the offset, in bytes, from the
1322 beginning of the member to the start of the corresponding Data.  This
1323 allows programs to skip to the beginning of the data for a particular
1324 source; it is also important to determine whether a source includes
1325 any string data (@pxref{SPV Legacy Member Data}).
1326
1327 The meaning of @code{x} in version 0xb0 is unknown.
1328
1329 @node SPV Legacy Member Data
1330 @subsection Data
1331
1332 @cartouche
1333 @format
1334 Data @result{} NumericData*[@t{n-variables}] StringData?
1335 NumericData @result{} byte*288[@t{variable-name}] double*[@t{n-data}]
1336 @end format
1337 @end cartouche
1338
1339 Data follow the Metadata in the legacy binary format, with sources in
1340 the same order.  Each NumericSeries begins with a @code{variable-name}
1341 that generally indicates its role in the pivot table, e.g.@: ``cell'',
1342 ``cellFormat'', ``dimension0categories'', ``dimension0group0'',
1343 followed by the numeric data, one double per datum.  A double with the
1344 maximum negative double @code{-DBL_MAX} represents the system-missing
1345 value SYSMIS.
1346
1347 @cartouche
1348 @format
1349 StringData @result{} i1 string[@t{source-name}] Pairs Labels
1350
1351 Pairs @result{} int[@t{n-string-vars}] PairSeries*[@t{n-string-vars}]
1352 PairVar @result{} string[@t{pair-var-name}] int[@t{n-pairs}] Pair*[@t{n-pairs}]
1353 Pair @result{} int[@t{i}] int[@t{j}]
1354
1355 Labels @result{} int[@t{n-labels}] Label*[@t{n-labels}]
1356 Label @result{} int[@t{frequency}] int[@t{s}]
1357 @end format
1358 @end cartouche
1359
1360 A source may include a mix of numeric and string data values.  When a
1361 source includes any string data, the data values that are strings are
1362 set to SYSMIS in the NumericData, and StringData follows the
1363 NumericData.  A source that contains no string data omits the
1364 StringData.  To reliably determine whether a source includes
1365 StringData, the reader should check whether the offset following the
1366 NumericData is the offset of the next source, as indicated by its
1367 Metadata (or the end of the member, in the case of the last source).
1368
1369 StringData repeats the name of the source (from Metadata).
1370
1371 The string data overlays the numeric data.  @code{n-string-vars} is
1372 the number of variables in the source that include string data.  More
1373 precisely, it is the 1-based index of the last variable in the source
1374 that includes any string data; thus, it would be 4 if there are 5
1375 variables and only the fourth one includes string data.
1376
1377 Each PairVar consists a sequence of 0 or more Pair nonterminals, each
1378 of which maps from a 0-based index within variable @code{i} to a
1379 0-based label index @code{j}, e.g.@: pair @code{i} = 2, @code{j} = 3,
1380 means that the third data value (with value SYSMIS) is to be replaced
1381 by the string of the fourth Label.
1382
1383 The labels themselves follow the pairs.  The valuable part of each
1384 label is the string @code{s}.  Each label also includes a
1385 @code{frequency} that reports the number of pairs that reference it
1386 (although this is not useful).
1387
1388 @node SPV Legacy Detail Member XML Format
1389 @section Legacy Detail Member XML Format
1390
1391 This format is still under investigation.
1392
1393 The design of the detail XML format is not what one would end up with
1394 for describing pivot tables.  This is because it is a special case
1395 of a much more general format (``visualization XML'' or ``VizML'')
1396 that can describe a wide range of visualizations.  Most of this
1397 generality is overkill for tables, and so we end up with a funny
1398 subset of a general-purpose format.
1399
1400 The important elements of the detail XML format are:
1401
1402 @itemize @bullet
1403 @item
1404 Variables.  Variables in detail XML roughly correspond to the
1405 dimensions in a light detail member.  There is one variable for each
1406 dimension, plus one variable for each level of labeling along an axis.
1407
1408 The bulk of variables are defined with @code{sourceVariable} elements.
1409 The data for these variables comes from the associated
1410 @code{tableData.bin} member.  Some variables are defined, with
1411 @code{derivedVariable} elements, as a constant or in terms of a
1412 mapping function from a source variable.
1413
1414 @item
1415 Assignment of variables to axes.  A variable can appear as columns, or
1416 rows, or layers.  The @code{faceting} element and its sub-elements
1417 describe this assignment.
1418 @end itemize
1419
1420 All elements have an optional @code{id} attribute.  In practice many
1421 elements are assigned @code{id} attributes that are never referenced.
1422
1423 @menu
1424 * SPV Detail visualization Element::
1425 * SPV Detail userSource Element::
1426 * SPV Detail sourceVariable Element::
1427 * SPV Detail derivedVariable Element::
1428 * SPV Detail extension Element::
1429 * SPV Detail graph Element::
1430 * SPV Detail location Element::
1431 * SPV Detail coordinates Element::
1432 * SPV Detail faceting Element::
1433 * SPV Detail facetLayout Element::
1434 @end menu
1435
1436 @node SPV Detail visualization Element
1437 @subsection The @code{visualization} Element
1438
1439 @format
1440 Parent: Document root
1441 Contents:
1442      extension?
1443      userSource
1444      (sourceVariable @math{|} derivedVariable)@math{+}
1445      graph
1446      labelFrame@math{+}
1447      container?
1448      style@math{+}
1449      layerController?
1450 @end format
1451
1452 This element has the following attributes.
1453
1454 @defvr {Required} creator
1455 The version of the software that created this SPV file, as a string of
1456 the form @code{xxyyzz}, which represents software version xx.yy.zz,
1457 e.g.@: @code{160001} is version 16.0.1.  The corpus includes major
1458 versions 16 through 19.
1459 @end defvr
1460
1461 @defvr {Required} date
1462 The date on the which the file was created, as a string of the form
1463 @code{YYYY-MM-DD}.
1464 @end defvr
1465
1466 @defvr {Required} lang
1467 The locale used for output, in Windows format, which is similar to the
1468 format used in Unix with the underscore replaced by a hyphen, e.g.@:
1469 @code{en-US}, @code{en-GB}, @code{el-GR}, @code{sr-Cryl-RS}.
1470 @end defvr
1471
1472 @defvr {Required} name
1473 The title of the pivot table, localized to the output language.
1474 @end defvr
1475
1476 @defvr {Required} style
1477 The @code{id} of a @code{style} element (@pxref{SPV Detail style
1478 element}).  This is the base style for the entire pivot table.  In
1479 every example in the corpus, the value is @code{visualizationStyle}
1480 and the corresponding @code{style} element has no attributes other
1481 than @code{id}.
1482 @end defvr
1483
1484 @defvr {Required} type
1485 A floating-point number.  The meaning is unknown.
1486 @end defvr
1487
1488 @defvr {Required} version
1489 The visualization schema version number.  In the corpus, the value is
1490 one of 2.4, 2.5, 2.7, and 2.8.
1491 @end defvr
1492
1493 @node SPV Detail userSource Element
1494 @subsection The @code{userSource} Element
1495
1496 Parent: @code{visualization} @*
1497 Contents:
1498
1499 This element has the following attributes.
1500
1501 @defvr {Optional} missing
1502 Always @code{listwise}.
1503 @end defvr
1504
1505 @node SPV Detail sourceVariable Element
1506 @subsection The @code{sourceVariable} Element
1507
1508 Parent: @code{visualization} @*
1509 Contents: @code{extension}* (@code{format} @math{|} @code{stringFormat})?
1510
1511 This element defines a variable whose values can be used elsewhere in
1512 the visualization.  It ties this element's @code{id} to a variable
1513 from the @file{tableData.bin} member that corresponds to this
1514 @file{.xml}.
1515
1516 This element has the following attributes.
1517
1518 @defvr {Required} categorical
1519 Always set to @code{true}.
1520 @end defvr
1521
1522 @defvr {Required} source
1523 Always set to @code{tableData}, the @code{source-name} in the
1524 corresponding @file{tableData.bin} member (@pxref{SPV Legacy Member
1525 Metadata}).
1526 @end defvr
1527
1528 @defvr {Required} sourceName
1529 The name of a variable within the source, the @code{variable-name} in
1530 the corresponding @file{tableData.bin} member (@pxref{SPV Legacy
1531 Member Data}).
1532 @end defvr
1533
1534 @defvr {Optional} dependsOn
1535 The @code{variable-name} of a variable linked to this one, so that a
1536 viewer can work with them together.  For a group variable, this is the
1537 name of the corresponding categorical variable.
1538 @end defvr
1539
1540 @defvr {Optional} label
1541 The variable label, if any
1542 @end defvr
1543
1544 @defvr {Optional} labelVariable
1545 The @code{variable-name} of a variable whose string values correspond
1546 one-to-one with the values of this variable and are suitable for use
1547 as value labels.
1548 @end defvr
1549
1550 @node SPV Detail derivedVariable Element
1551 @subsection The @code{derivedVariable} Element
1552
1553 Parent: @code{visualization} @*
1554 Contents: @code{extension}* (@code{format} @math{|} @code{stringFormat} @code{valueMapEntry}*)
1555
1556 Like @code{sourceVariable}, this element defines a variable whose
1557 values can be used elsewhere in the visualization.  Instead of being
1558 read from a data source, the variable's data are defined by a
1559 mathematical expression.
1560
1561 This element has the following attributes.
1562
1563 @defvr {Required} categorical
1564 Always set to @code{true}.
1565 @end defvr
1566
1567 @defvr {Required} value
1568 An expression that defines the variable's value.  In theory this could
1569 be an arbitrary expression in terms of constants, functions, and other
1570 variables, e.g.@: @math{(@var{var1} + @var{var2}) / 2}.  In practice,
1571 the corpus contains only the following forms of expressions:
1572
1573 @table @code
1574 @item constant(@var{number})
1575 @itemx constant(@var{variable})
1576 A constant.  The meaning when a variable is named is unknown.
1577 Sometimes the ``variable name'' has spaces in it.
1578
1579 @item map(@var{variable})
1580 Transforms the values in the named @var{variable} using the
1581 @code{valueMapEntry}s contained within the element.
1582 @end table
1583 @end defvr
1584
1585 @defvr {Optional} dependsOn
1586 The @code{variable-name} of a variable linked to this one, so that a
1587 viewer can work with them together.  For a group variable, this is the
1588 name of the corresponding categorical variable.
1589 @end defvr
1590
1591 @menu
1592 * SPV Detail valueMapEntry Element::
1593 @end menu
1594
1595 @node SPV Detail valueMapEntry Element
1596 @subsubsection The @code{valueMapEntry} Element
1597
1598 Parent: @code{derivedVariable} @*
1599 Contents: empty
1600
1601 A @code{valueMapEntry} element defines a mapping from one or more
1602 values of a source expression to a target value.  (In the corpus, the
1603 source expression is always just the name of a variable.)  Each target
1604 value requires a separate @code{valueMapEntry}.  If multiple source
1605 values map to the same target value, they can be combined or separate.
1606
1607 @code{valueMapEntry} has the following attributes.
1608
1609 @defvr {Required} from
1610 A source value, or multiple source values separated by semicolons,
1611 e.g.@: @code{0} or @code{13;14;15;16}.
1612 @end defvr
1613
1614 @defvr {Required} to
1615 The target value.
1616 @end defvr
1617
1618 @node SPV Detail extension Element
1619 @subsection The @code{extension} Element
1620
1621 This is a general-purpose ``extension'' element.  Readers that don't
1622 understand a given extension should be able to safely ignore it.  The
1623 attributes on this element, and their meanings, vary based on the
1624 context.  Each known usage is described separately below.  The current
1625 extensions use attributes exclusively, without any nested elements.
1626
1627 @subsubheading @code{visualization} Parent Element
1628
1629 With @code{visualization} as its parent element, @code{extension} has
1630 the following attributes.
1631
1632 @defvr {Optional} numRows
1633 An integer that presumably defines the number of rows in the displayed
1634 pivot table.
1635 @end defvr
1636
1637 @defvr {Optional} showGridline
1638 Always set to @code{false} in the corpus.
1639 @end defvr
1640
1641 @defvr {Optional} minWidthSet
1642 @defvrx {Optional} maxWidthSet
1643 Always set to @code{true} in the corpus.
1644 @end defvr
1645
1646 @subsubheading @code{container} Parent Element
1647
1648 With @code{container} as its parent element, @code{extension} has the
1649 following attributes.
1650
1651 @defvr {Required} combinedFootnotes
1652 Always set to @code{true} in the corpus.
1653 @end defvr
1654
1655 @subsubheading @code{sourceVariable} and @code{derivedVariable} Parent Element
1656
1657 With @code{sourceVariable} or @code{derivedVariable} as its parent
1658 element, @code{extension} has the following attributes.  A given
1659 parent element often contains several @code{extension} elements that
1660 specify the meaning of the source data's variables or sources, e.g.@:
1661
1662 @example
1663 <extension from="0" helpId="corrected_model"/>
1664 <extension from="3" helpId="error"/>
1665 <extension from="4" helpId="total_9"/>
1666 <extension from="5" helpId="corrected_total"/>
1667 @end example
1668
1669 @defvr {Required} from
1670 An integer or a name like ``dimension0''.
1671 @end defvr
1672
1673 @defvr {Required} helpId
1674 An identifier.
1675 @end defvr
1676
1677 @node SPV Detail graph Element
1678 @subsection The @code{graph} Element
1679
1680 Parent: @code{visualization} @*
1681 Contents: @code{location}@math{+} @code{coordinates} @code{faceting} @code{facetLayout} @code{interval}
1682
1683 @code{graph} has the following attributes.
1684
1685 @defvr {Required} cellStyle
1686 @defvrx {Required} style
1687 Each of these is the @code{id} of a @code{style} element (@pxref{SPV
1688 Detail style element}).  The former is the default style for
1689 individual cells, the latter for the entire table.
1690 @end defvr
1691
1692 @node SPV Detail location Element
1693 @subsection The @code{location} Element
1694
1695 Parent: @code{graph} @*
1696 Contents: empty
1697
1698 Each instance of this element specifies where some part of the table
1699 frame is located.  All the examples in the corpus have four instances
1700 of this element, one for each of the parts @code{height},
1701 @code{width}, @code{left}, and @code{top}.  Some examples in the
1702 corpus add a fifth for part @code{bottom}, even though it is not clear
1703 how all of @code{top}, @code{bottom}, and @code{heigth} can be honored
1704 at the same time.  In any case, @code{location} seems to have little
1705 importance in representing tables; a reader can safely ignore it.
1706
1707 @defvr {Required} part
1708 One of @code{height}, @code{width}, @code{top}, @code{bottom}, or
1709 @code{left}.  Presumably @code{right} is acceptable as well but the
1710 corpus contains no examples.
1711 @end defvr
1712
1713 @defvr {Required} method
1714 How the location is determined:
1715
1716 @table @code
1717 @item sizeToContent
1718 Based on the natural size of the table.  Observed only for
1719 parts @code{height} and @code{width}.
1720
1721 @item attach
1722 Based on the location specified in @code{target}.  Observed only for
1723 parts @code{top} and @code{bottom}.
1724
1725 @item fixed
1726 Using the value in @code{value}.  Observed only for parts @code{top},
1727 @code{bottom}, and @code{left}.
1728
1729 @item same
1730 Same as the specified @code{target}.  Observed only for part
1731 @code{left}.
1732 @end table
1733 @end defvr
1734
1735 @defvr {Optional} min
1736 Minimum size.  Only observed with value @code{100pt}.  Only observed
1737 for part @code{width}.
1738 @end defvr
1739
1740 @defvr {Dependent} target
1741 Required when @code{method} is @code{attach} or @code{same}, not
1742 observed otherwise.  This is the ID of an element to attach to.
1743 Observed with the ID of @code{title}, @code{footnote}, @code{graph},
1744 and other elements.
1745 @end defvr
1746
1747 @defvr {Dependent} value
1748 Required when @code{method} is @code{fixed}, not observed otherwise.
1749 Observed values are @code{0%}, @code{0px}, @code{1px}, and @code{3px}
1750 on parts @code{top} and @code{left}, and @code{100%} on part
1751 @code{bottom}.
1752 @end defvr
1753
1754 @node SPV Detail coordinates Element
1755 @subsection The @code{coordinates} Element
1756
1757 Parent: @code{graph} @*
1758 Contents: empty
1759
1760 This element is always present and always empty, with no attributes
1761 (except @code{id}).
1762
1763 @node SPV Detail faceting Element
1764 @subsection The @code{faceting} Element
1765
1766 Parent: @code{graph} @*
1767 Contents: @code{cross} @code{layer}*
1768
1769 The @code{faceting} element describes the row, column, and layer
1770 structure of the table.  Its @code{cross} child determines the row and
1771 column structure, and each @code{layer} child (if any) represents a
1772 layer.
1773
1774 @code{faceting} has no attributes (other than @code{id}).
1775
1776 @subsubheading The @code{cross} Element
1777
1778 Parent: @code{faceting} @*
1779 Contents: @code{nest} @code{nest}
1780
1781 The @code{cross} element describes the row and column structure of the
1782 table.  It has exactly two @code{nest} children, the first of which
1783 describes the table's rows and the second the table's columns.
1784
1785 @code{cross} has no attributes (other than @code{id}).
1786
1787 @subsubheading The @code{nest} Element
1788
1789 Parent: @code{cross} @*
1790 Contents: @code{variableReference}@math{+}
1791
1792 A given @code{nest} usually consists of one or more dimensions, each
1793 of which is represented by @code{variableReference} child elements.
1794 Minimally, a dimension has two @code{variableReference} children, one
1795 for the categories, one for the data, e.g.:
1796
1797 @example
1798 <nest>
1799   <variableReference ref="dimension0categories"/>
1800   <variableReference ref="dimension0"/>
1801 </nest>
1802 @end example
1803
1804 @noindent
1805 Groups of categories introduce additional variable references, e.g.@:
1806
1807 @example
1808 <nest>
1809   <variableReference ref="dimension0categories"/>
1810   <variableReference ref="dimension0group0"/>
1811   <variableReference ref="dimension0"/>
1812 </nest>
1813 @end example
1814
1815 @noindent
1816 Grouping can be hierarchical, e.g.@:
1817
1818 @example
1819 <nest>
1820   <variableReference ref="dimension0categories"/>
1821   <variableReference ref="dimension0group1"/>
1822   <variableReference ref="dimension0group0"/>
1823   <variableReference ref="dimension0"/>
1824 </nest>
1825 @end example
1826
1827 @noindent
1828 XXX what are group maps?
1829
1830 @example
1831 <nest id="nest_1973">
1832   <variableReference ref="dimension1categories"/>
1833   <variableReference ref="dimension1group1map"/>
1834   <variableReference ref="dimension1group0map"/>
1835   <variableReference ref="dimension1"/>
1836 </nest>
1837 <nest>
1838   <variableReference ref="dimension0categories"/>
1839   <variableReference ref="dimension0group0map"/>
1840   <variableReference ref="dimension0"/>
1841 </nest>
1842 @end example
1843
1844 @noindent
1845 A @code{nest} can contain multiple dimensions:
1846
1847 @example
1848 <nest>
1849   <variableReference ref="dimension1categories"/>
1850   <variableReference ref="dimension1group0"/>
1851   <variableReference ref="dimension1"/>
1852   <variableReference ref="dimension0categories"/>
1853   <variableReference ref="dimension0"/>
1854 </nest>
1855 @end example
1856
1857 One @code{nest} within a given @code{cross} may have no dimensions, in
1858 which case it still has one @code{variableReference} child, which
1859 references a @code{derivedVariable} whose @code{value} attribute is
1860 @code{constant(0)}.  In the corpus, such a @code{derivedVariable} has
1861 @code{row} or @code{column}, respectively, as its @code{id}.
1862
1863 @code{nest} has no attributes (other than @code{id}).
1864
1865 @subsubheading The @code{variableReference} Element
1866
1867 Parent: @code{nest} @*
1868 Contents: empty
1869
1870 @code{variableReference} has one attribute.
1871
1872 @defvr {Required} ref
1873 The @code{id} of a @code{sourceVariable} or @code{derivedVariable}
1874 element.
1875 @end defvr
1876
1877 @subsubheading The @code{layer} Element
1878
1879 Parent: @code{faceting} @*
1880 Contents: empty
1881
1882 Each layer is represented by a pair of @code{layer} elements.  The
1883 first of this pair is for a category variable, the second for the data
1884 variable, e.g.:
1885
1886 @example
1887 <layer value="0" variable="dimension0categories" visible="true"/>
1888 <layer value="dimension0" variable="dimension0" visible="false"/>
1889 @end example
1890
1891 @noindent
1892 @code{layer} has the following attributes.
1893
1894 @defvr {Required} variable
1895 The @code{id} of a @code{sourceVariable} or @code{derivedVariable}
1896 element.
1897 @end defvr
1898
1899 @defvr {Required} value
1900 The value to select.  For a category variable, this is always
1901 @code{0}; for a data variable, it is the same as the @code{variable}
1902 attribute.
1903 @end defvr
1904
1905 @defvr {Optional} visible
1906 Whether the layer is visible.  Generally, category layers are visible
1907 and data layers are not, but sometimes this attribute is omitted.
1908 @end defvr
1909
1910 @defvr {Optional} method
1911 When present, this is always @code{nest}.
1912 @end defvr
1913
1914 @node SPV Detail facetLayout Element
1915 @subsection The @code{facetLayout} Element
1916
1917 Parent: @code{graph} @*
1918 Contents: @code{tableLayout} @code{facetLevel}@math{+} @code{setCellProperties}*
1919
1920 @subsubheading The @code{tableLayout} Element
1921
1922 Parent: @code{facetLayout} @*
1923 Contents: empty
1924
1925 @defvr {Required} verticalTitlesInCorner
1926 Always set to @code{true}.
1927 @end defvr
1928
1929 @defvr {Optional} style
1930 The @code{id} of a @code{style} element.
1931 @end defvr
1932
1933 @defvr {Optional} fitCells
1934 Always set to @code{ticks}.
1935 @end defvr
1936
1937 @subsubheading The @code{facetLevel} Element
1938
1939 Parent: @code{facetLayout} @*
1940 Contents: @code{axis}
1941
1942 Each @code{facetLevel} describes a @code{variableReference} or
1943 @code{layer}, and a table has one @code{facetLevel} element for
1944 each such element.  For example, an SPV detail member that contains
1945 four @code{variableReference} elements and two @code{layer} elements
1946 will contain six @code{facetLevel} elements.
1947
1948 In the corpus, @code{facetLevel} elements and the elements that they
1949 describe are always in the same order.  The correspondence may also be
1950 observed in two other ways.  First, one may use the @code{level}
1951 attribute, described below.  Second, in the corpus, a
1952 @code{facetLevel} always has an @code{id} that is the same as the
1953 @code{id} of the element it describes with @code{_facetLevel}
1954 appended.  One should not formally rely on this, of course, but it is
1955 usefully indicative.
1956
1957 @defvr {Required} level
1958 A 1-based index into the @code{variableReference} and @code{layer}
1959 elements, e.g.@: a @code{facetLayout} with a @code{level} of 1
1960 describes the first @code{variableReference} in the SPV detail member,
1961 and in a member with four @code{variableReference} elements, a
1962 @code{facetLayout} with a @code{level} of 5 describes the first
1963 @code{layer} in the member.
1964 @end defvr
1965
1966 @defvr {Required} gap
1967 Always observed as @code{0pt}.
1968 @end defvr
1969
1970 @subsubheading The @code{axis} Element
1971
1972 Parent: @code{facetLevel} @*
1973 Contents: @code{label}? @code{majorTicks}
1974
1975 @defvr {Attribute} style
1976 The @code{id} of a @code{style} element.
1977 @end defvr
1978
1979 @subsubheading The @code{label} Element
1980
1981 Parent: @code{axis} or @code{labelFrame} @*
1982 Contents: @code{text}@math{+} @math{|} @code{descriptionGroup}
1983
1984 This element represents a label on some aspect of the table.  For example,
1985 the table's title is a @code{label}.
1986
1987 The contents of the label can be one or more @code{text} elements or a
1988 @code{descriptionGroup}.
1989
1990 @defvr {Attribute} style
1991 @defvrx {Optional} textFrameStyle
1992 Each of these is the @code{id} of a @code{style} element.
1993 @code{style} is the style of the label text, @code{textFrameStyle} the
1994 style for the frame around the label.
1995 @end defvr
1996
1997 @defvr {Optional} purpose
1998 The kind of entity being labeled, one of @code{title},
1999 @code{subTitle}, @code{layer}, or @code{footnote}.
2000 @end defvr
2001
2002 @subsubheading The @code{descriptionGroup} Element
2003
2004 Parent: @code{label} @*
2005 Contents: (@code{description} @math{|} @code{text})@math{+}
2006
2007 A @code{descriptionGroup} concatenates one or more elements to form a
2008 label.  Each element can be a @code{text} element, which contains
2009 literal text, or a @code{description} element that substitutes a value
2010 or a variable name.
2011
2012 @defvr {Attribute} target
2013 The @code{id} of an element being described.  In the corpus, this is
2014 always @code{faceting}.
2015 @end defvr
2016
2017 @defvr {Attribute} separator
2018 A string to separate the description of multiple groups, if the
2019 @code{target} has more than one.  In the corpus, this is always a
2020 new-line.
2021 @end defvr
2022
2023 Typical contents for a @code{descriptionGroup} are a value by itself:
2024 @example
2025 <description name="value"/>
2026 @end example
2027 @noindent or a variable and its value, separated by a colon:
2028 @example
2029 <description name="variable"/><text>:</text><description name="value"/>
2030 @end example
2031
2032 @subsubheading The @code{description} Element
2033
2034 Parent: @code{descriptionGroup} @*
2035 Contents: empty
2036
2037 A @code{description} is like a macro that expands to some property of
2038 the target of its parent @code{descriptionGroup}.
2039
2040 @defvr {Attribute} name
2041 The name of the property.  Only @code{variable} and @code{value}
2042 appear in the corpus.
2043 @end defvr
2044
2045 @subsubheading The @code{majorTicks} Element
2046
2047 Parent: @code{axis} @*
2048 Contents: @code{gridline}?
2049
2050 @defvr {Attribute} labelAngle
2051 @defvrx {Attribute} length
2052 Both always defined to @code{0}.
2053 @end defvr
2054
2055 @defvr {Attribute} style
2056 @defvrx {Attribute} tickFrameStyle
2057 Each of these is the @code{id} of a @code{style} element.
2058 @code{style} is the style of the tick labels, @code{tickFrameStyle}
2059 the style for the frames around the labels.
2060 @end defvr
2061
2062 @subsubheading The @code{gridline} Element
2063
2064 Parent: @code{majorTicks} @*
2065 Contents: empty
2066
2067 Represents ``gridlines,'' which for a table represents the lines
2068 between the rows or columns of a table (XXX?).
2069
2070 @defvr {Attribute} style
2071 The style for the gridline.
2072 @end defvr
2073
2074 @defvr {Attribute} zOrder
2075 Observed as a number between 28 and 31.  Does not seem to be
2076 important.
2077 @end defvr
2078
2079 @subsubheading The @code{setCellProperties} Element
2080
2081 Parent: @code{facetLayout} @*
2082 Contents: @code{setMetaData} @code{setStyle}* @code{setFormat}@math{+} @code{union}?
2083
2084 This element sets style properties of cells designated by the
2085 @code{target} attribute of its child elements, as further restricted
2086 by the optional @code{union} element if present.  The @code{target}
2087 values often used, e.g.@: @code{graph} or @code{labeling}, actually
2088 affect every cell, so the @code{union} element is a useful
2089 restriction.
2090
2091 @defvr {Optional} applyToConverse
2092 If present, always @code{true}.  This appears to invert the meaning of
2093 the @code{target} of sub-elements: the selected cells are the ones
2094 @emph{not} designated by @code{target}.  This is confusing, given the
2095 additional restrictions of @code{union}, but in the corpus
2096 @code{applyToConverse} is never present along with @code{union}.
2097 @end defvr
2098
2099 @subsubheading The @code{setMetaData} Element
2100
2101 Parent: @code{setCellProperties} @*
2102 Contents: empty
2103
2104 This element is not known to have any visible effect.
2105
2106 @defvr {Required} target
2107 The @code{id} of an element whose metadata is to be set.  In the
2108 corpus, this is always @code{graph}, the @code{id} used for the
2109 @code{graph} element.
2110 @end defvr
2111
2112 @defvr {Required} key
2113 @defvrx {Required} value
2114 A key-value pair to set for the target.
2115
2116 In the corpus, @code{key} is @code{cellPropId} or, rarely,
2117 @code{diagProps}, and @code{value} is always the @code{id} of the
2118 parent @code{setCellProperties}.
2119 @end defvr
2120
2121 @subsubheading The @code{setStyle} Element
2122
2123 Parent: @code{setCellProperties} @*
2124 Contents: empty
2125
2126 This element associates a style with the target.
2127
2128 @defvr {Required} target
2129 The @code{id} of an element whose style is to be set.  In the corpus,
2130 this is always the @code{id} of an @code{interval}, @code{labeling},
2131 or, rarely, @code{graph} element.
2132 @end defvr
2133
2134 @defvr {Required} style
2135 The @code{id} of a @code{style} element that identifies the style to
2136 set on the target.
2137 @end defvr
2138
2139 @subsubheading The @code{setFormat} Element
2140
2141 @format
2142 Parent: @code{setCellProperties}
2143 Contents:
2144     @code{format}
2145   @math{|} @code{numberFormat}
2146   @math{|} @code{stringFormat}@math{+}
2147   @math{|} @code{dateTimeFormat}
2148 @end format
2149
2150 This element sets the format of the target, ``format'' in this case
2151 meaning the SPSS print format for a variable.
2152
2153 The details of this element vary depending on the schema version, as
2154 declared in the root @code{visualization} element's @code{version}
2155 attribute (@pxref{SPV Detail visualization Element}).  In version 2.5
2156 and earlier, @code{setFormat} contains one of a number of child
2157 elements that correspond to the different varieties of print formats.
2158 In version 2.7 and later, @code{setFormat} instead always contains a
2159 @code{format} element.
2160
2161 XXX reinvestigate the above claim about versions: it appears to be
2162 incorrect.
2163
2164 The @code{setFormat} element itself has the following attributes.
2165
2166 @defvr {Required} target
2167 The @code{id} of an element whose style is to be set.  In the corpus,
2168 this is always the @code{id} of an @code{majorTicks} or
2169 @code{labeling} element.
2170 @end defvr
2171
2172 @defvr {Optional} reset
2173 If this is @code{true}, this format overrides the target's previous
2174 format.  If it is @code{false}, the adds to the previous format.  In
2175 the corpus this is always @code{true}.  The default behavior is
2176 unknown.
2177 @end defvr
2178
2179 @menu
2180 * SPV Detail format Element::
2181 * SPV Detail numberFormat Element::
2182 * SPV Detail stringFormat Element::
2183 * SPV Detail dateTimeFormat Element::
2184 * SPV Detail affix Element::
2185 * SPV Detail relabel Element::
2186 * SPV Detail union Element::
2187 @end menu
2188
2189 @node SPV Detail format Element
2190 @subsubsection The @code{format} Element
2191
2192 Parent: @code{sourceVariable}, @code{derivedVariable}, @code{formatMapping}, @code{labeling}, @code{formatMapping}, @code{setFormat} @*
2193 Contents: (@code{affix}@math{+} @math{|} @code{relabel}@math{+})?
2194
2195 This element appears only in schema version 2.7 (@pxref{SPV Detail
2196 visualization Element}).
2197
2198 This element determines a format, equivalent to an SPSS print format.
2199
2200 @subsubheading Attributes for All Formats
2201
2202 These attributes apply to all kinds of formats.  The most important of
2203 these attributes determines the high-level kind of formatting in use:
2204
2205 @defvr {Optional} baseFormat
2206 Either @code{dateTime} or @code{elapsedTime}.  When this attribute is
2207 omitted, this element is a numeric or string format.
2208 @end defvr
2209
2210 @noindent
2211 Whether, in the corpus, other attributes are always present (``yes''),
2212 never present (``no''), or sometimes present (``opt'') depends on
2213 @code{baseFormat}:
2214
2215 @multitable {maximumFractionDigits} {@code{dateTime}} {@code{elapsedTime}} {number} {string}
2216 @headitem Attribute @tab @code{dateTime} @tab @code{elapsedTime} @tab number @tab string
2217 @item errorCharacter        @tab yes @tab yes @tab yes @tab opt
2218 @item @w{ }
2219 @item separatorChars        @tab yes @tab  no @tab  no @tab no
2220 @item @w{ }
2221 @item mdyOrder              @tab yes @tab  no @tab  no @tab no
2222 @item @w{ }
2223 @item showYear              @tab yes @tab  no @tab  no @tab no
2224 @item yearAbbreviation      @tab yes @tab  no @tab  no @tab no
2225 @item @w{ }
2226 @item showMonth             @tab yes @tab  no @tab  no @tab no
2227 @item monthFormat           @tab yes @tab  no @tab  no @tab no
2228 @item @w{ }
2229 @item showDay               @tab yes @tab opt @tab  no @tab no
2230 @item dayPadding            @tab yes @tab opt @tab  no @tab no
2231 @item dayOfMonthPadding     @tab yes @tab  no @tab  no @tab no
2232 @item dayType               @tab yes @tab  no @tab  no @tab no
2233 @item @w{ }
2234 @item showHour              @tab yes @tab opt @tab  no @tab no
2235 @item hourFormat            @tab yes @tab opt @tab  no @tab no
2236 @item hourPadding           @tab yes @tab yes @tab  no @tab no
2237 @item @w{ }
2238 @item showMinute            @tab yes @tab yes @tab  no @tab no
2239 @item minutePadding         @tab yes @tab yes @tab  no @tab no
2240 @item @w{ }
2241 @item showSecond            @tab yes @tab yes @tab  no @tab no
2242 @item secondPadding         @tab  no @tab yes @tab  no @tab no
2243 @item @w{ }
2244 @item showMillis            @tab  no @tab yes @tab  no @tab no
2245 @item @w{ }
2246 @item minimumIntegerDigits  @tab  no @tab  no @tab yes @tab no
2247 @item maximumFractionDigits @tab  no @tab yes @tab yes @tab no
2248 @item minimumFractionDigits @tab  no @tab yes @tab yes @tab no
2249 @item useGrouping           @tab  no @tab opt @tab yes @tab no
2250 @item scientific            @tab  no @tab  no @tab yes @tab no
2251 @item small                 @tab  no @tab  no @tab opt @tab no
2252 @item suffix                @tab  no @tab  no @tab opt @tab no
2253 @item @w{ }
2254 @item tryStringsAsNumbers   @tab  no @tab  no @tab  no @tab yes
2255 @item @w{ }
2256 @end multitable
2257
2258 @defvr {Attribute} errorCharacter
2259 A character that replaces the formatted value when it cannot otherwise
2260 be represented in the given format.  Always @samp{*}.
2261 @end defvr
2262
2263 @subsubheading Date and Time Attributes
2264
2265 These attributes are used with @code{dateTime} and @code{elapsedTime}
2266 formats or both.
2267
2268 @defvr {Attribute} separatorChars
2269 Exactly four characters.  In order, these are used for: decimal point,
2270 grouping, date separator, time separator.  Always @samp{.,-:}.
2271 @end defvr
2272
2273 @defvr {Attribute} mdyOrder
2274 Within a date, the order of the days, months, and years.
2275 @code{dayMonthYear} is the only observed value, but one would expect
2276 that @code{monthDayYear} and @code{yearMonthDay} to be reasonable as
2277 well.
2278 @end defvr
2279
2280 @defvr {Attribute} showYear
2281 @defvrx {Attribute} yearAbbreviation
2282 Whether to include the year and, if so, whether the year should be
2283 shown abbreviated, that is, with only 2 digits.  Each is @code{true}
2284 or @code{false}; only values of @code{true} and @code{false},
2285 respectively, have been observed.
2286 @end defvr
2287
2288 @defvr {Attribute} showMonth
2289 @defvrx {Attribute} monthFormat
2290 Whether to include the month (@code{true} or @code{false}) and, if so,
2291 how to format it.  @code{monthFormat} is one of the following:
2292
2293 @table @code
2294 @item long
2295 The full name of the month, e.g.@: in an English locale,
2296 @code{September}.
2297
2298 @item short
2299 The abbreviated name of the month, e.g.@: in an English locale,
2300 @code{Sep}.
2301
2302 @item number
2303 The number representing the month, e.g.@: 9 for September.
2304
2305 @item paddedNumber
2306 A two-digit number representing the month, e.g.@: 09 for September.
2307 @end table
2308
2309 Only values of @code{true} and @code{short}, respectively, have been
2310 observed.
2311 @end defvr
2312
2313 @defvr {Attribute} dayPadding
2314 @defvrx {Attribute} dayOfMonthPadding
2315 @defvrx {Attribute} hourPadding
2316 @defvrx {Attribute} minutePadding
2317 @defvrx {Attribute} secondPadding
2318 These attributes presumably control whether each field in the output
2319 is padded with spaces to its maximum width, but the details are not
2320 understood.  The only observed value for any of these attributes is
2321 @code{true}.
2322 @end defvr
2323
2324 @defvr {Attribute} showDay
2325 @defvrx {Attribute} showHour
2326 @defvrx {Attribute} showMinute
2327 @defvrx {Attribute} showSecond
2328 @defvrx {Attribute} showMillis
2329 These attributes presumably control whether each field is displayed
2330 in the output, but the details are not understood.  The only
2331 observed value for any of these attributes is @code{true}.
2332 @end defvr
2333
2334 @defvr {Attribute} dayType
2335 This attribute is always @code{month} in the corpus, specifying that
2336 the day of the month is to be displayed; a value of @code{year} is
2337 supposed to indicate that the day of the year, where 1 is January 1,
2338 is to be displayed instead.
2339 @end defvr
2340
2341 @defvr {Attribute} hourFormat
2342 @code{hourFormat}, if present, is one of:
2343
2344 @table @code
2345 @item AMPM
2346 The time is displayed with an @code{am} or @code{pm} suffix, e.g.@:
2347 @code{10:15pm}.
2348
2349 @item AS_24
2350 The time is displayed in a 24-hour format, e.g.@: @code{22:15}.
2351
2352 This is the only value observed in the corpus.
2353
2354 @item AS_12
2355 The time is displayed in a 12-hour format, without distinguishing
2356 morning or evening, e.g.@: @code{10;15}.
2357 @end table
2358
2359 @code{hourFormat} is sometimes present for @code{elapsedTime} formats,
2360 which is confusing since a time duration does not have a concept of AM
2361 or PM.  This might indicate a bug in the code that generated the XML
2362 in the corpus, or it might indicate that @code{elapsedTime} is
2363 sometimes used to format a time of day.
2364 @end defvr
2365
2366 @subsubheading Numeric Attributes
2367
2368 These attributes are used for formats when @code{baseFormat} is
2369 @code{number}.  Attributes @code{maximumFractionDigits}, and
2370 @code{minimumFractionDigits}, and @code{useGrouping} are also used
2371 when @code{baseFormat} is @code{elapsedTime}.
2372
2373 @defvr {Attribute} minimumIntegerDigits
2374 Minimum number of digits to display before the decimal point.  Always
2375 observed as @code{0}.
2376 @end defvr
2377
2378 @defvr {Attribute} maximumFractionDigits
2379 @defvrx {Attribute} maximumFractionDigits
2380 Maximum or minimum, respectively, number of digits to display after
2381 the decimal point.  The observed values of each attribute range from 0
2382 to 9.
2383 @end defvr
2384
2385 @defvr {Attribute} useGrouping
2386 Whether to use the grouping character to group digits in large
2387 numbers.  It would make sense for the grouping character to come from
2388 the @code{separatorChars} attribute, but that attribute is only
2389 present when @code{baseFormat} is @code{dateTime} or
2390 @code{elapsedTime}, in the corpus at least.  Perhaps that is because
2391 this attribute has only been observed as @code{false}.
2392 @end defvr
2393
2394 @defvr {Attribute} scientific
2395 This attribute controls when and whether the number is formatted in
2396 scientific notation.  It takes the following values:
2397
2398 @table @code
2399 @item onlyForSmall
2400 Use scientific notation only when the number's magnitude is smaller
2401 than the value of the @code{small} attribute.
2402
2403 @item whenNeeded
2404 Use scientific notation when the number will not otherwise fit in the
2405 available space.
2406
2407 @item true
2408 Always use scientific notation.  Not observed in the corpus.
2409
2410 @item false
2411 Never use scientific notation.  A number that won't otherwise fit will
2412 be replaced by an error indication (see the @code{errorCharacter}
2413 attribute).  Not observed in the corpus.
2414 @end table
2415 @end defvr
2416
2417 @defvr {Optional} small
2418 Only present when the @code{scientific} attribute is
2419 @code{onlyForSmall}, this is a numeric magnitude below which the
2420 number will be formatted in scientific notation.  The values @code{0}
2421 and @code{0.0001} have been observed.  The value @code{0} seems like a
2422 pathological choice, since no real number has a magnitude less than 0;
2423 perhaps in practice such a choice is equivalent to setting
2424 @code{scientific} to @code{false}.
2425 @end defvr
2426
2427 @defvr {Optional} prefix
2428 @defvrx {Optional} suffix
2429 Specifies a prefix or a suffix to apply to the formatted number.  Only
2430 @code{suffix} has been observed, with value @samp{%}.
2431 @end defvr
2432
2433 @subsubheading String Attributes
2434
2435 These attributes are used for formats when @code{baseFormat} is
2436 @code{string}.
2437
2438 @defvr {Attribute} tryStringsAsNumbers
2439 When this is @code{true}, it is supposed to indicate that string
2440 values should be parsed as numbers and then displayed according to
2441 numeric formatting rules.  However, in the corpus it is always
2442 @code{false}.
2443 @end defvr
2444
2445 @node SPV Detail numberFormat Element
2446 @subsubsection The @code{numberFormat} Element
2447
2448 Parent: @code{setFormat} @*
2449 Contents: @code{affix}@math{+}
2450
2451 This element appears only in schema version 2.5 and earlier
2452 (@pxref{SPV Detail visualization Element}).  Possibly this element
2453 could also contain @code{relabel} elements in a more diverse corpus.
2454
2455 This element has the following attributes.
2456
2457 @defvr {Attribute} maximumFractionDigits
2458 @defvrx {Attribute} minimumFractionDigits
2459 @defvrx {Attribute} minimumIntegerDigits
2460 @defvrx {Optional} scientific
2461 @defvrx {Optional} small
2462 @defvrx {Optional} suffix
2463 @defvrx {Optional} useGroupging
2464 The syntax and meaning of these attributes is the same as on the
2465 @code{format} element for a numeric format.  @pxref{SPV Detail format
2466 element}.
2467 @end defvr
2468
2469 @node SPV Detail stringFormat Element
2470 @subsubsection The @code{stringFormat} Element
2471
2472 Parent: @code{setFormat} @*
2473 Contents: (@code{affix}@math{+} @math{|} @code{relabel}@math{+})?
2474
2475 This element appears only in schema version 2.5 and earlier
2476 (@pxref{SPV Detail visualization Element}).
2477
2478 This element has no attributes.
2479
2480 @node SPV Detail dateTimeFormat Element
2481 @subsubsection The @code{dateTimeFormat} Element
2482
2483 Parent: @code{setFormat} @*
2484 Contents: empty
2485
2486 This element appears only in schema version 2.5 and earlier
2487 (@pxref{SPV Detail visualization Element}).  Possibly this element
2488 could also contain @code{affix} and @code{relabel} elements in a more
2489 diverse corpus.
2490
2491 The following attribute is required.
2492
2493 @defvr {Attribute} baseFormat
2494 Either @code{dateTime} or @code{time}.
2495 @end defvr
2496
2497 When @code{baseFormat} is @code{dateTime}, the following attributes
2498 are available.
2499
2500 @defvr {Attribute} dayOfMonthPadding
2501 @defvrx {Attribute} dayPadding
2502 @defvrx {Attribute} dayType
2503 @defvrx {Attribute} hourFormat
2504 @defvrx {Attribute} hourPadding
2505 @defvrx {Attribute} mdyOrder
2506 @defvrx {Attribute} minutePadding
2507 @defvrx {Attribute} monthFormat
2508 @defvrx {Attribute} separatorChars
2509 @defvrx {Attribute} showDay
2510 @defvrx {Attribute} showHour
2511 @defvrx {Attribute} showMinute
2512 @defvrx {Attribute} showMonth
2513 @defvrx {Attribute} showSecond
2514 @defvrx {Attribute} showYear
2515 @defvrx {Attribute} yearAbbreviation
2516 The syntax and meaning of these attributes is the same as on the
2517 @code{format} element when that element's @code{baseFormat} is
2518 @code{dateTime}.  @pxref{SPV Detail format Element}.
2519 @end defvr
2520
2521 When @code{baseFormat} is @code{time}, the following attributes are
2522 available.
2523
2524 @defvr {Attribute} hourFormat
2525 @defvrx {Attribute} hourPadding
2526 @defvrx {Attribute} minutePadding
2527 @defvrx {Attribute} monthFormat
2528 @defvrx {Attribute} separatorChars
2529 @defvrx {Attribute} showDay
2530 @defvrx {Attribute} showHour
2531 @defvrx {Attribute} showMinute
2532 @defvrx {Attribute} showMonth
2533 @defvrx {Attribute} showSecond
2534 @defvrx {Attribute} showYear
2535 @defvrx {Attribute} yearAbbreviation
2536 The syntax and meaning of these attributes is the same as on the
2537 @code{format} element when that element's @code{baseFormat} is
2538 @code{elapsedTime}.  @pxref{SPV Detail format Element}.
2539 @end defvr
2540
2541 @node SPV Detail affix Element
2542 @subsubsection The @code{affix} Element
2543
2544 Parent: @code{format} or @code{numberFormat} or @code{stringFormat} @*
2545 Contents: empty
2546
2547 Possibly this element could have @code{dateTimeFormat} as a parent in
2548 a more diverse corpus.
2549
2550 This defines a suffix (or, theoretically, a prefix) for a formatted
2551 value.  It is used to insert a reference to a footnote.  It has the
2552 following attributes:
2553
2554 @defvr {Attribute} definesReference
2555 This specifies the footnote number as a natural number: 1 for the
2556 first footnote, 2 for the second, and so on.
2557 @end defvr
2558
2559 @defvr {Attribute} position
2560 Position for the footnote label.  Always @code{superscript}.
2561 @end defvr
2562
2563 @defvr {Attribute} suffix
2564 Whether the affix is a suffix (@code{true}) or a prefix
2565 (@code{false}).  Always @code{true}.
2566 @end defvr
2567
2568 @defvr {Attribute} value
2569 The text of the suffix or prefix.  Typically a letter, e.g.@: @code{a}
2570 for footnote 1, @code{b} for footnote 2, @enddots{}  The corpus
2571 contains other values: @code{*}, @code{**}, and a few that begin with
2572 at least one comma: @code{,b}, @code{,c}, @code{,,b}, and @code{,,c}.
2573 @end defvr
2574
2575 @node SPV Detail relabel Element
2576 @subsubsection The @code{relabel} Element
2577
2578 Parent: @code{format} or @code{stringFormat} @*
2579 Contents: empty
2580
2581 Possibly this element could have @code{numberFormat} or
2582 @code{dateTimeFormat} as a parent in a more diverse corpus.
2583
2584 This specifies how to display a given value.  It is used to implement
2585 value labels and to display the system-missing value in a
2586 human-readable way.  It has the following attributes:
2587
2588 @defvr {Attribute} from
2589 The value to map.  In the corpus this is an integer or the
2590 system-missing value @code{-1.797693134862316E300}.
2591 @end defvr
2592
2593 @defvr {Attribute} to
2594 The string to display in place of the value of @code{from}.  In the
2595 corpus this is a wide variety of value labels; the system-missing
2596 value is mapped to @samp{.}.
2597 @end defvr
2598
2599 @node SPV Detail union Element
2600 @subsubsection The @code{union} Element
2601
2602 Parent: @code{setCellProperties} @*
2603 Contents: @code{intersect}@math{+}
2604
2605 This element represents a set of cells, computed as the union of the
2606 sets represented by each of its children.
2607
2608 @subsubheading The @code{intersect} Element
2609
2610 Parent: @code{union} @*
2611 Contents: @code{where}@math{+} @math{|} @code{intersectWhere}?
2612
2613 This element represents a set of cells, computed as the intersection
2614 of the sets represented by each of its children.
2615
2616 Of the two possible children, in the corpus @code{where} is far more
2617 common, appearing thousands of times, whereas @code{intersectWhere}
2618 only appears 4 times.
2619
2620 Most @code{intersect} elements have two or more children.
2621
2622 @subsubheading The @code{where} Element
2623
2624 Parent: @code{intersect} @*
2625 Contents: empty
2626
2627 This element represents the set of cells in which the value of a
2628 specified variable falls within a specified set.
2629
2630 @defvr {Attribute} variable
2631 The @code{id} of a variable, e.g.@: @code{dimension0categories} or
2632 @code{dimension0group0map}.
2633 @end defvr
2634
2635 @defvr {Attribute} include
2636 A value, or multiple values separated by semicolons,
2637 e.g.@: @code{0} or @code{13;14;15;16}.
2638 @end defvr
2639
2640 @subsubheading The @code{intersectWhere}
2641
2642 Parent: @code{intersect} @*
2643 Contents: empty
2644
2645 The meaning of this element is unknown.
2646
2647 @defvr {Attribute} variable
2648 @defvrx {Attribute} variable2
2649 The meaning of these attributes is unknown.  In the four examples in
2650 the corpus they always take the values @code{dimension2categories} and
2651 @code{dimension0categories}, respectively.
2652 @end defvr