1 @node SPSS Viewer File Format
2 @chapter SPSS Viewer File Format
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
11 SPSS 15 and earlier versions use a completely different output format
12 based on the Microsoft Compound Document Format. This format is not
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
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.
35 Structure members contain XML. This XML is sometimes self-contained,
36 but it often references detail members in the Zip archive, which are
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.
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.
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.
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
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.
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.
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::
80 @node SPV Structure Member Format
81 @section Structure Member Format
83 A structure member lays out the high-level structure for a group of
84 output items such as heading, tables, and charts. Structure members
85 do not include the details of tables and charts but instead refer to
86 them by their member names.
88 Structure members' XML files claim conformance with a collection of
89 XML Schemas. These schemas are distributed, under a nonfree license,
90 with SPSS binaries. Fortunately, the schemas are not necessary to
91 understand the structure members. The schemas can even
92 be deceptive because they document elements and attributes that are
93 not in the corpus and do not document elements and attributes that are
94 commonly found in the corpus.
96 Structure members use a different XML namespace for each schema, but
97 these namespaces are not entirely consistent. In some SPV files, for
98 example, the @code{viewer-tree} schema is associated with namespace
99 @indicateurl{http://xml.spss.com/spss/viewer-tree} and in others with
100 @indicateurl{http://xml.spss.com/spss/viewer/viewer-tree} (note the
101 additional @file{viewer/}). Under either name, the schema URIs are
102 not resolvable to obtain the schemas themselves.
104 One may ignore all of the above in interpreting a structure member.
105 The actual XML has a simple and straightforward form that does not
106 require a reader to take schemas or namespaces into account. A
107 structure member's root is @code{heading} element, which contains
108 @code{heading} or @code{container} elements (or a mix), forming a
109 tree. In turn, @code{container} holds a single @code{text} or
110 @code{table} element.
113 For a diagram illustrating the hierarchy of elements within an SPV
114 structure member, please refer to a PDF version of the manual.
118 The following diagram shows the hierarchy within an SPV structure
119 member more precisely. Oval nodes are elements and <text> and <cdata>
120 are plain text and CDATA within elements. Edges point from parent to
121 child. Unlabeled edges indicate that the child appears exactly once;
122 edges labeled with *, zero or more times; edges labeled with ?, zero
124 @center @image{dev/spv-structure, 5in}
127 The elements found in structure members are documented below. For
128 each element, we note the possible parent elements and the element's
129 contents. The contents are specified as pseudo-regular expressions
130 with the following conventions:
143 Grouping multiple elements.
148 @item @var{a} @math{|} @var{b}
149 A choice between @var{a} and @var{b}.
152 Zero or more @var{x}.
155 The following example shows the contents of a typical structure member
156 for a @cmd{DESCRIPTIVES} procedure. A real structure member is not
157 indented. This example also omits most attributes, all XML namespace
158 information, and the CSS from the embedded HTML:
161 <?xml version="1.0" encoding="utf-8"?>
163 <label>Output</label>
164 <heading commandName="Descriptives">
165 <label>Descriptives</label>
168 <text commandName="Descriptives" type="title">
170 <![CDATA[<head><style type="text/css">...</style></head><BR>Descriptives]]>
174 <container visibility="hidden">
176 <table commandName="Descriptives" subType="Notes" type="note">
178 <dataPath>00000000001_lightNotesData.bin</dataPath>
183 <label>Descriptive Statistics</label>
184 <table commandName="Descriptives" subType="Descriptive Statistics"
187 <dataPath>00000000002_lightTableData.bin</dataPath>
196 * SPV Structure heading Element::
197 * SPV Structure label Element::
198 * SPV Structure container Element::
199 * SPV Structure text Element (Inside @code{container})::
200 * SPV Structure html Element::
201 * SPV Structure table Element::
202 * SPV Structure tableStructure Element::
203 * SPV Structure dataPath Element::
204 * SPV Structure pageSetup Element::
205 * SPV Structure pageHeader and pageFooter Elements::
206 * SPV Structure pageParagraph Element::
207 * SPV Structure @code{text} Element (Inside @code{pageParagraph})::
210 @node SPV Structure heading Element
211 @subsection The @code{heading} Element
213 Parent: Document root or @code{heading} @*
214 Contents: @code{pageSetup}? @code{label} (@code{container} @math{|} @code{heading})*
216 The root of a structure member is a @code{heading}, which represents a
217 section of output beginning with a title (the @code{label}) and
218 ordinarily followed by content containers or further nested
219 (sub)-sections of output. Unlike heading elements in HTML and other
220 common document formats, which precede the content that they head,
221 @code{heading} contains the elements that appear below the heading.
223 The document root heading, only, may also contain a @code{pageSetup}
226 The following attributes have been observed on both document root and
227 nested @code{heading} elements.
229 @defvr {Optional} creator-version
230 The version of the software that created this SPV file. A string of
231 the form @code{xxyyzzww} represents software version xx.yy.zz.ww,
232 e.g.@: @code{21000001} is version 21.0.0.1. Trailing pairs of zeros
233 are sometimes omitted, so that @code{21}, @code{210000}, and
234 @code{21000000} are all version 21.0.0.0 (and the corpus contains all
235 three of those forms).
239 The following attributes have been observed on document root
240 @code{heading} elements only:
242 @defvr {Optional} @code{creator}
243 The directory in the file system of the software that created this SPV
247 @defvr {Optional} @code{creation-date-time}
248 The date and time at which the SPV file was written, in a
249 locale-specific format, e.g.@: @code{Friday, May 16, 2014 6:47:37 PM
250 PDT} or @code{lunedì 17 marzo 2014 3.15.48 CET} or even @code{Friday,
251 December 5, 2014 5:00:19 o'clock PM EST}.
254 @defvr {Optional} @code{lockReader}
255 Whether a reader should be allowed to edit the output. The possible
256 values are @code{true} and @code{false}, but the corpus only contains
260 @defvr {Optional} @code{schemaLocation}
261 This is actually an XML Namespace attribute. A reader may ignore it.
265 The following attributes have been observed only on nested
266 @code{heading} elements:
268 @defvr {Required} @code{commandName}
269 The locale-invariant name of the command that produced the output,
270 e.g.@: @code{Frequencies}, @code{T-Test}, @code{Non Par Corr}.
273 @defvr {Optional} @code{visibility}
274 To what degree the output represented by the element is visible. The
275 only observed value is @code{collapsed}.
278 @defvr {Optional} @code{locale}
279 The locale used for output, in Windows format, which is similar to the
280 format used in Unix with the underscore replaced by a hyphen, e.g.@:
281 @code{en-US}, @code{en-GB}, @code{el-GR}, @code{sr-Cryl-RS}.
284 @defvr {Optional} @code{olang}
285 The output language, e.g.@: @code{en}, @code{it}, @code{es},
286 @code{de}, @code{pt-BR}.
289 @node SPV Structure label Element
290 @subsection The @code{label} Element
292 Parent: @code{heading} or @code{container} @*
295 Every @code{heading} and @code{container} holds a @code{label} as its
296 first child. The root @code{heading} in a structure member always
297 contains the string ``Output''. Otherwise, the text in @code{label}
298 describes what it labels, often by naming the statistical procedure
299 that was executed, e.g.@: ``Frequencies'' or ``T-Test''. Labels are
300 often very generic, especially within a @code{container}, e.g.@:
301 ``Title'' or ``Warnings'' or ``Notes''. Label text is localized
302 according to the output language, e.g.@: in Italian a frequency table
303 procedure is labeled ``Frequenze''.
305 The corpus contains a few examples of empty labels, ones that contain
308 This element has no attributes.
310 @node SPV Structure container Element
311 @subsection The @code{container} Element
313 Parent: @code{heading} @*
314 Contents: @code{label} (@code{table} @math{|} @code{text})?
316 A @code{container} serves to label a @code{table} or a @code{text}
319 This element has the following attributes.
321 @defvr {Required} @code{visibility}
322 Either @code{visible} or @code{hidden}, this indicates whether the
323 container's content is displayed.
326 @defvr {Optional} @code{text-align}
327 Presumably indicates the alignment of text within the container. The
328 only observed value is @code{left}. Observed with nested @code{table}
329 and @code{text} elements.
332 @defvr {Optional} @code{width}
333 The width of the container in the form @code{@var{n}px}, e.g.@:
337 @node SPV Structure text Element (Inside @code{container})
338 @subsection The @code{text} Element (Inside @code{container})
340 Parent: @code{container} @*
341 Contents: @code{html}
343 This @code{text} element is nested inside a @code{container}. There
344 is a different @code{text} element that is nested inside a
345 @code{pageParagraph}.
347 This element has the following attributes.
349 @defvr {Required} @code{type}
350 One of @code{title}, @code{log}, or @code{text}.
353 @defvr {Optional} @code{commandName}
354 As on the @code{heading} element. For output not specific to a
355 command, this is simply @code{log}. The corpus contains one example
356 of where @code{commandName} is present but set to the empty string.
359 @defvr {Optional} @code{creator-version}
360 As on the @code{heading} element.
363 @node SPV Structure html Element
364 @subsection The @code{html} Element
366 Parent: @code{text} @*
369 The CDATA contains an HTML document. In some cases, the document
370 starts with @code{<html>} and ends with @code{</html>}; in others the
371 @code{html} element is implied. Generally the HTML includes a
372 @code{head} element with a CSS stylesheet. The HTML body often begins
373 with @code{<BR>}. The actual content ranges from trivial to simple:
374 just discarding the CSS and tags yields readable results.
376 This element has the following attributes.
378 @defvr {Required} @code{lang}
379 This always contains @code{en} in the corpus.
382 @node SPV Structure table Element
383 @subsection The @code{table} Element
385 Parent: @code{container} @*
386 Contents: @code{tableStructure}
388 This element has the following attributes.
390 @defvr {Required} @code{commandName}
391 As on the @code{heading} element.
394 @defvr {Required} @code{type}
395 One of @code{table}, @code{note}, or @code{warning}.
398 @defvr {Required} @code{subType}
399 The locale-invariant name for the particular kind of output that this
400 table represents in the procedure. This can be the same as
401 @code{commandName} e.g.@: @code{Frequencies}, or different, e.g.@:
402 @code{Case Processing Summary}. Generic subtypes @code{Notes} and
403 @code{Warnings} are often used.
406 @defvr {Required} @code{tableId}
407 A number that uniquely identifies the table within the SPV file,
408 typically a large negative number such as @code{-4147135649387905023}.
411 @defvr {Optional} @code{creator-version}
412 As on the @code{heading} element. In the corpus, this is only present
413 for version 21 and up and always includes all 8 digits.
416 @node SPV Structure tableStructure Element
417 @subsection The @code{tableStructure} Element
419 Parent: @code{table} @*
420 Contents: @code{dataPath}
422 This element has no attributes.
424 @node SPV Structure dataPath Element
425 @subsection The @code{dataPath} Element
427 Parent: @code{tableStructure} @*
430 Contains the name of the Zip member that holds the table details,
431 e.g.@: @code{0000000001437_lightTableData.bin}.
433 This element has no attributes.
435 @node SPV Structure pageSetup Element
436 @subsection The @code{pageSetup} Element
438 Parent: @code{heading} @*
439 Contents: @code{pageHeader} @code{pageFooter}
441 This element has the following attributes.
443 @defvr {Required} @code{initial-page-number}
447 @defvr {Optional} @code{chart-size}
448 Always @code{as-is} or a localization (!) of it (e.g.@: @code{dimensione
449 attuale}, @code{Wie vorgegeben}).
452 @defvr {Optional} @code{margin-left}
453 @defvrx {Optional} @code{margin-right}
454 @defvrx {Optional} @code{margin-top}
455 @defvrx {Optional} @code{margin-bottom}
456 Margin sizes in the form @code{@var{size}in}, e.g.@: @code{0.25in}.
459 @defvr {Optional} @code{paper-height}
460 @defvrx {Optional} @code{paper-width}
461 Paper sizes in the form @code{@var{size}in}, e.g.@: @code{8.5in} by
462 @code{11in} for letter paper or @code{8.267in} by @code{11.692in} for
466 @defvr {Optional} @code{reference-orientation}
470 @defvr {Optional} @code{space-after}
474 @node SPV Structure pageHeader and pageFooter Elements
475 @subsection The @code{pageHeader} and @code{pageFooter} Elements
477 Parent: @code{pageSetup} @*
478 Contents: @code{pageParagraph}*
480 This element has no attributes.
482 @node SPV Structure pageParagraph Element
483 @subsection The @code{pageParagraph} Element
485 Parent: @code{pageHeader} or @code{pageFooter} @*
486 Contents: @code{text}
488 Text to go at the top or bottom of a page, respectively.
490 This element has no attributes.
492 @node SPV Structure @code{text} Element (Inside @code{pageParagraph})
493 @subsection The @code{text} Element (Inside @code{pageParagraph})
495 Parent: @code{pageParagraph} @*
498 This @code{text} element is nested inside a @code{pageParagraph}. There
499 is a different @code{text} element that is nested inside a
502 The element is either empty, or contains CDATA that holds almost-XHTML
503 text: in the corpus, either an @code{html} or @code{p} element. It is
504 @emph{almost}-XHTML because the @code{html} element designates the
506 @indicateurl{http://xml.spss.com/spss/viewer/viewer-tree} instead of an XHTML
507 namespace, and because the CDATA can contain substitution variables:
508 @code{&[Page]} for the page number and @code{&[PageTitle]} for the
511 Typical contents (indented for clarity):
514 <html xmlns="http://xml.spss.com/spss/viewer/viewer-tree">
517 <p style="text-align:right; margin-top: 0">Page &[Page]</p>
522 This element has the following attributes.
524 @defvr {Required} @code{type}
528 @node SPV Light Detail Member Format
529 @section Light Detail Member Format
531 This section describes the format of ``light'' detail @file{.bin}
532 members. These members have a binary format which we describe here in
533 terms of a context-free grammar using the following conventions:
536 @item NonTerminal @result{} @dots{}
537 Nonterminals have CamelCaps names, and @result{} indicates a
538 production. The right-hand side of a production is often broken
539 across multiple lines. Break points are chosen for aesthetics only
540 and have no semantic significance.
542 @item 00, 01, @dots{}, ff.
543 A bytes with a fixed value, written as a pair of hexadecimal digits.
545 @item i0, i1, @dots{}, i9, i10, i11, @dots{}
546 @itemx b0, b1, @dots{}, b9, b10, b11, @dots{}
547 A 32-bit integer in little-endian or big-endian byte order,
548 respectively, with a fixed value, written in decimal, prefixed by
555 A byte with value 0 or 1.
559 A 16-bit integer in little-endian or big-endian byte order,
564 A 32-bit integer in little-endian or big-endian byte order,
569 A 64-bit integer in little-endian or big-endian byte order,
573 A 64-bit IEEE floating-point number.
576 A 32-bit IEEE floating-point number.
580 A 32-bit integer, in little-endian or big-endian byte order,
581 respectively, followed by the specified number of bytes of character
582 data. (The encoding is indicated by the Formats nonterminal.)
585 @var{x} is optional, e.g.@: 00? is an optional zero byte.
587 @item @var{x}*@var{n}
588 @var{x} is repeated @var{n} times, e.g. byte*10 for ten arbitrary bytes.
590 @item @var{x}[@var{name}]
591 Gives @var{x} the specified @var{name}. Names are used in textual
592 explanations. They are also used, also bracketed, to indicate counts,
593 e.g.@: int[@t{n}] byte*[@t{n}] for a 32-bit integer followed by the
594 specified number of arbitrary bytes.
596 @item @var{a} @math{|} @var{b}
597 Either @var{a} or @var{b}.
600 Parentheses are used for grouping to make precedence clear, especially
601 in the presence of @math{|}, e.g.@: in 00 (01 @math{|} 02 @math{|} 03)
605 A 32-bit integer that indicates the number of bytes in @var{x},
606 followed by @var{x} itself.
609 In a version 1 @file{.bin} member, @var{x}; in version 3, nothing.
610 (The @file{.bin} header indicates the version.)
613 In a version 3 @file{.bin} member, @var{x}; in version 1, nothing.
616 Little-endian byte order is far more common in this format, but a few
617 pieces of the format use big-endian byte order.
619 A ``light'' detail member @file{.bin} consists of a number of sections
620 concatenated together, terminated by a byte 01:
624 LightMember @result{}
627 Fonts Borders PrintSettings TableSettings Formats
633 The following sections go into more detail.
636 * SPV Light Member Header::
637 * SPV Light Member Title::
638 * SPV Light Member Caption::
639 * SPV Light Member Footnotes::
640 * SPV Light Member Fonts::
641 * SPV Light Member Borders::
642 * SPV Light Member Print Settings::
643 * SPV Light Member Table Settings::
644 * SPV Light Member Formats::
645 * SPV Light Member Dimensions::
646 * SPV Light Member Categories::
647 * SPV Light Member Data::
648 * SPV Light Member Value::
649 * SPV Light Member ValueMod::
652 @node SPV Light Member Header
655 An SPV light member begins with a 39-byte header:
661 (i1 @math{|} i3)[@t{version}]
663 bool[@t{show-numeric-markers}]
664 bool[@t{rotate-inner-column-labels}]
665 bool[@t{rotate-outer-row-labels}]
668 int[@t{min-column-width}] int[@t{max-column-width}]
669 int[@t{min-row-width}] int[@t{max-row-width}]
674 @code{version} is a version number that affects the interpretation of
675 some of the other data in the member. We will refer to ``version 1''
676 and ``version 3'' later on and use v1(@dots{}) and v3(@dots{}) for
677 version-specific formatting (as described previously).
679 If @code{show-numeric-markers} is 1, footnote markers are shown as
680 numbers, starting from 1; otherwise, they are shown as letters,
681 starting from @samp{a}.
683 If @code{rotate-inner-column-labels} is 1, then column labels closest
684 to the data are rotated to be vertical; otherwise, they are shown
687 If @code{rotate-outer-row-labels} is 1, then row labels farthest from
688 the data are rotated to be vertical; otherwise, they are shown in the
691 @code{table-id} is a binary version of the @code{tableId} attribute in
692 the structure member that refers to the detail member. For example,
693 if @code{tableId} is @code{-4122591256483201023}, then @code{table-id}
694 would be 0xc6c99d183b300001.
696 @code{min-column-width} is the minimum width that a column will be
697 assigned automatically. @code{max-column-width} is the maximum width
698 that a column will be assigned to accommodate a long column label.
699 @code{min-row-width} and @code{max-row-width} are a similar range for
700 the width of row labels. All of these measurements are in 1/96 inch
703 The meaning of the other variable parts of the header is not known.
705 @node SPV Light Member Title
711 Value[@t{title1}] 01?
713 Value[@t{title2}] 01?
717 The Title, which follows the Header, specifies the pivot table's title
718 twice, as @code{title1} and @code{title2}. In the corpus, they are
721 Whereas the Value in @code{title1} and in @code{title2} are
722 appropriate for presentation, and localized to the user's language,
723 @code{c} is in English, sometimes less specific, and sometimes less
724 well formatted. For example, for a frequency table, @code{title1} and
725 @code{title2} name the variable and @code{c} is simply ``Frequencies''.
727 @node SPV Light Member Caption
732 Caption @result{} Caption1 Caption2
733 Caption1 @result{} 31 Value @math{|} 58
734 Caption2 @result{} 31 Value @math{|} 58
738 The Caption, if present, is shown below the table. Caption2 is
739 normally present. Caption1 is only rarely nonempty; it might reflect
740 user editing of the caption.
742 @node SPV Light Member Footnotes
743 @subsection Footnotes
747 Footnotes @result{} int[@t{n}] Footnote*[@t{n}]
748 Footnote @result{} Value[@t{text}] (58 @math{|} 31 Value[@t{marker}]) byte*4
752 Each footnote has @code{text} and an optional customer @code{marker}
755 @node SPV Light Member Fonts
760 Fonts @result{} 00 Font*8
763 string[@t{typeface}] float[@t{size}] int[@t{style}] bool[@t{underline}]
764 int[@t{halign}] int[@t{valign}]
765 string[@t{fgcolor}] string[@t{bgcolor}]
766 byte[@t{alternate}] string[@t{altfg}] string[@t{altbg}]
767 v3(int[@t{left-margin}] int[@t{right-margin}] int[@t{top-margin}] int[@t{bottom-margin}])
771 Each Font represents the font style for a different element, in the
772 following order: title, caption, footer, corner, column
773 labels, row labels, data, and layers.
775 @code{index} is the 1-based index of the Font, i.e. 1 for the first
776 Font, through 8 for the final Font.
778 @code{typeface} is the string name of the font. In the corpus, this
779 is @code{SansSerif} in over 99% of instances and @code{Times New
782 @code{size} is the size of the font, in points. The most common size
783 in the corpus is 12 points.
785 @code{style} is a bit mask. Bit 0 (with value 1) is set for bold, bit
786 1 (with value 2) is set for italic.
788 @code{underline} is 1 if the font is underlined, 0 otherwise.
790 @code{halign} specifies horizontal alignment: 0 for center, 2 for
791 left, 4 for right, 61453 for decimal, 64173 for mixed. Mixed
792 alignment varies according to type: string data is left-justified,
793 numbers and most other formats are right-justified.
795 @code{valign} specifies vertical alignment: 0 for center, 1 for top, 3
798 @code{fgcolor} and @code{bgcolor} are the foreground color and
799 background color, respectively. In the corpus, these are always
800 @code{#000000} and @code{#ffffff}, respectively.
802 @code{alternate} is 01 if rows should alternate colors, 00 if all rows
803 should be the same color. When @code{alternate} is 01, @code{altfg}
804 and @code{altbg} specify the colors for the alternate rows.
806 @code{left-margin}, @code{right-margin}, @code{top-margin}, and
807 @code{bottom-margin} are measured in multiples of 1/96 inch.
809 @node SPV Light Member Borders
816 be32[@t{n-borders}] Border*[@t{n-borders}]
817 bool[@t{show-grid-lines}]
821 be32[@t{border-type}]
822 be32[@t{stroke-type}]
827 The Borders reflect how borders between regions are drawn.
829 The fixed value of @code{endian} can be used to validate the
832 @code{show-grid-lines} is 1 to draw grid lines, otherwise 0.
834 Each Border describes one kind of border. @code{n-borders} seems to
835 always be 19. Each @code{border-type} appears once (although in an
836 unpredictable order) and correspond to the following borders:
842 Left, top, right, and bottom outer frame.
844 Left, top, right, and bottom inner frame.
846 Left and top of data area.
848 Horizontal and vertical dimension rows.
850 Horizontal and vertical dimension columns.
852 Horizontal and vertical category rows.
854 Horizontal and vertical category columns.
857 @code{stroke-type} describes how a border is drawn, as one of:
874 @code{color} is an RGB color. Bits 24--31 are alpha, bits 16--23 are
875 red, 8--15 are green, 0--7 are blue. An alpha of 255 indicates an
876 opaque color, therefore opaque black is 0xff000000.
878 @node SPV Light Member Print Settings
879 @subsection Print Settings
883 PrintSettings @result{}
886 bool[@t{paginate-layers}]
889 bool[@t{top-continuation}]
890 bool[@t{bottom-continuation}]
891 be32[@t{n-orphan-lines}]
892 bestring[@t{continuation-string}]
896 The PrintSettings reflect settings for printing. The fixed value of
897 @code{endian} can be used to validate the endianness.
899 @code{all-layers} is 1 to print all layers, 0 to print only the
902 @code{paginate-layers} is 1 to print each layer at the start of a new
903 page, 0 otherwise. (This setting is honored only @code{all-layers} is
904 1, since otherwise only one layer is printed.)
906 @code{fit-width} and @code{fit-length} control whether the table is
907 shrunk to fit within a page's width or length, respectively.
909 @code{n-orphan-lines} is the minimum number of rows or columns to put
910 in one part of a table that is broken across pages.
912 If @code{top-continuation} is 1, then @code{continuation-string} is
913 printed at the top of a page when a table is broken across pages for
914 printing; similarly for @code{bottom-continuation} and the bottom of a
915 page. Usually, @code{continuation-string} is empty.
917 @node SPV Light Member Table Settings
918 @subsection Table Settings
922 TableSettings @result{}
925 be32[@t{current-layer}]
927 bool[@t{show-row-labels-in-corner}]
928 bool[@t{show-alphabetic-markers}]
929 bool[@t{footnote-marker-position}]
933 Breakpoints[@t{row-breaks}] Breakpoints[@t{column-breaks}]
934 Keeps[@t{row-keeps}] Keeps[@t{column-keeps}]
935 PointKeeps[@t{row-keeps}] PointKeeps[@t{column-keeps}]
938 bestring[@t{table-look}]
942 Breakpoints @result{} be32[@t{n-breaks}] be32*[@t{n-breaks}]
944 Keeps @result{} be32[@t{n-keeps}] Keep*@t{n-keeps}
945 Keep @result{} be32[@t{offset}] be[@t{n}]
947 PointKeeps @result{} be32[@t{n-point-keeps}] PointKeep*@t{n-point-keeps}
948 PointKeep @result{} be32[@t{offset}] be32 be32
953 The TableSettings reflect display settings. The fixed value of
954 @code{endian} can be used to validate the endianness.
956 @code{current-layer} is the displayed layer.
958 If @code{omit-empty} is 1, empty rows or columns (ones with nothing in
959 any cell) are hidden; otherwise, they are shown.
961 If @code{show-row-labels-in-corner} is 1, then row labels are shown in
962 the upper left corner; otherwise, they are shown nested.
964 If @code{show-alphabetic-markers} is 1, markers are shown as letters
965 (e.g. @samp{a}, @samp{b}, @samp{c}, @dots{}); otherwise, they are
966 shown as numbers starting from 1.
968 When @code{footnote-marker-position} is 1, footnote markers are shown
969 as superscripts, otherwise as subscripts.
971 The Breakpoints are rows or columns after which there is a page break;
972 for example, a row break of 1 requests a page break after the second
973 row. Usually no breakpoints are specified, indicating that page
974 breaks should be selected automatically.
976 The Keeps are ranges of rows or columns to be kept together without a
977 page break; for example, a row Keep with @code{offset} 1 and @code{n}
978 10 requests that the 10 rows starting with the second row be kept
979 together. Usually no Keeps are specified.
981 The PointKeeps seem to be generated automatically based on
982 user-specified Keeps. They seems to indicate a conversion from rows
983 or columns to pixel or point offsets.
985 @code{notes} is a text string that contains user-specified notes. It
986 is displayed when the user hovers the cursor over the table, like
987 ``alt text'' on a webpage. It is not printed. It is usually empty.
989 @code{table-look} is the name of a SPSS ``TableLook'' table style,
990 such as ``Default'' or ``Academic''; it is often empty.
992 TableSettings ends with an arbitrary number of null bytes.
994 @node SPV Light Member Formats
1000 int[@t{n-widths}] int*[@t{n-widths}]
1001 string[@t{encoding}]
1002 int[@t{current-layer}]
1003 bool[@t{digit-grouping}] bool[@t{leading-zero}] bool
1005 byte[@t{decimal}] byte[@t{grouping}]
1009 v3(count(X1 count(X2)) count(X3))
1013 string[@t{command}] string[@t{command-local}]
1014 string[@t{language}] string[@t{charset}] string[@t{locale}]
1017 byte[@t{decimal}] byte[@t{grouping}]
1019 byte[@t{missing}] bool
1024 byte[@t{variable-mode}]
1025 byte[@t{value-mode}]
1031 int[@t{n-heights}] int*[@t{n-heights}]
1032 int[@t{n-style-map}] BlankMap*[@t{n-style-map}]
1033 int[@t{n-styles}] StylePair*[@t{n-styles}]
1035 StyleMap @result{} int64[@t{cell-index}] int16[@t{style-index}]
1037 01 00 (03 @math{|} 04) 00 00 00
1038 string[@t{command}] string[@t{command-local}]
1039 string[@t{language}] string[@t{charset}] string[@t{locale}]
1042 byte[@t{decimal}] byte[@t{grouping}]
1043 double[@t{small}] 01
1044 (string[@t{dataset}] string[@t{datafile}] i0 int[@t{date}] i0)?
1046 byte[@t{missing}] bool (i2000000 i0)?
1048 CustomCurrency @result{} int[@t{n-ccs}] string*[@t{n-ccs}]
1052 If @code{n-widths} is nonzero, then the accompanying integers are
1053 column widths as manually adjusted by the user. (Row heights are
1054 computed automatically based on the widths.)
1056 @code{encoding} is a character encoding, usually a Windows code page
1057 such as @code{en_US.windows-1252} or @code{it_IT.windows-1252}. The
1058 rest of the character strings in the member use this encoding. The
1059 encoding string is itself encoded in US-ASCII.
1061 @code{epoch} is the year that starts the epoch. A 2-digit year is
1062 interpreted as belonging to the 100 years beginning at the epoch. The
1063 default epoch year is 69 years prior to the current year; thus, in
1064 2017 this field by default contains 1948. In the corpus, @code{epoch}
1065 ranges from 1943 to 1948, plus some contain -1.
1067 @code{decimal} is the decimal point character. The observed values
1068 are @samp{.} and @samp{,}.
1070 @code{grouping} is the grouping character. Usually, it is @samp{,} if
1071 @code{decimal} is @samp{.}, and vice versa. Other observed values are
1072 @samp{'} (apostrophe), @samp{ } (space), and zero (presumably
1073 indicating that digits should not be grouped).
1075 @code{command} describes the statistical procedure that generated the
1076 output, in English. It is not necessarily the literal syntax name of
1077 the procedure: for example, NPAR TESTS becomes ``Nonparametric
1078 Tests.'' @code{command-local} is the procedure's name, translated
1079 into the output language; it is often empty and, when it is not,
1080 sometimes the same as @code{command}.
1082 @code{dataset} is the name of the dataset analyzed to produce the
1083 output, e.g.@: @code{DataSet1}, and @code{datafile} the name of the
1084 file it was read from, e.g.@: @file{C:\Users\foo\bar.sav}. The latter
1085 is sometimes the empty string.
1087 @code{date} is a date, as seconds since the epoch, i.e.@: since
1088 January 1, 1970. Pivot tables within an SPV files often have dates a
1089 few minutes apart, so this is probably a creation date for the tables
1090 rather than for the file.
1092 Sometimes @code{dataset}, @code{datafile}, and @code{date} are present
1093 and other times they are absent. The reader can distinguish by
1094 assuming that they are present and then checking whether the
1095 presumptive @code{dataset} contains a null byte (a valid string never
1098 @code{n-ccs} is observed as either 0 or 5. When it is 5, the
1099 following strings are CCA through CCE format strings. @xref{Custom
1100 Currency Formats,,, pspp, PSPP}. Most commonly these are all
1101 @code{-,,,} but other strings occur.
1103 @code{missing} is the character used to indicate that a cell contains
1104 a missing value. It is always observed as @samp{.}.
1106 @node SPV Light Member Dimensions
1107 @subsection Dimensions
1109 A pivot table presents multidimensional data. A Dimension identifies
1110 the categories associated with each dimension.
1114 Dimensions @result{} int[@t{n-dims}] Dimension*[@t{n-dims}]
1115 Dimension @result{} Value[@t{name}] DimProperties int[@t{n-categories}] Category*[@t{n-categories}]
1116 DimProperties @result{}
1118 (00 @math{|} 01 @math{|} 02)[@t{d2}]
1119 (i0 @math{|} i2)[@t{d3}]
1120 bool[@t{show-dim-label}]
1121 bool[@t{hide-all-labels}]
1122 01 int[@t{dim-index}]
1126 @code{name} is the name of the dimension, e.g. @code{Variables},
1127 @code{Statistics}, or a variable name.
1129 The meanings of @code{d1}, @code{d2}, and @code{d3} are unknown.
1130 @code{d1} is usually 0 but many other values have been observed.
1132 If @code{show-dim-label} is 01, the pivot table displays a label for
1133 the dimension itself. Because usually the group and category labels
1134 are enough explanation, it is usually 00.
1136 If @code{hide-all-labels} is 01, the pivot table omits all labels for
1137 the dimension, including group and category labels. It is usually 00.
1138 When @code{hide-all-labels} is 01, @code{show-dim-label} is ignored.
1140 @code{dim-index} is usually the 0-based index of the dimension, e.g.@:
1141 0 for the first dimension, 1 for the second, and so on. Sometimes it
1142 is -1. There is no visible difference.
1144 @node SPV Light Member Categories
1145 @subsection Categories
1147 Categories are arranged in a tree. Only the leaf nodes in the tree
1148 are really categories; the others just serve as grouping constructs.
1152 Category @result{} Value[@t{name}] (Leaf @math{|} Group)
1153 Leaf @result{} 00 00 00 i2 int[@t{cat-index}] i0
1155 bool[@t{merge}] 00 01 (i0 @math{|} i2)[@t{data}]
1156 i-1 int[@t{n-subcategories}] Category*[@t{n-subcategories}]
1160 @code{name} is the name of the category (or group).
1162 A Leaf represents a leaf category. The Leaf's @code{cat-index} is a
1163 nonnegative integer less than @code{n-categories} in the Dimension in
1164 which the Category is nested (directly or indirectly). These
1165 categories represent the original order in which the categories were
1166 sorted; if the user sorted or rearranged the categories, then the
1167 order of categories in the file reflects that without changing the
1168 @code{cat-index} values.
1170 A Group is a group of nested categories. Usually a Group contains at
1171 least one Category, so that @code{n-subcategories} is positive, but a
1172 few Groups with @code{n-subcategories} 0 has been observed.
1174 If a Group's @code{merge} is 00, the most common value, then the group
1175 is really a distinct group that should be represented as such in the
1176 visual representation and user interface. If @code{merge} is 01, the
1177 categories in this group should be shown and treated as if they were
1178 direct children of the group's containing group (or if it has no
1179 parent group, then direct children of the dimension), and this group's
1180 name is irrelevant and should not be displayed. (Merged groups can be
1183 A Group's @code{data} appears to be i2 when all of the categories
1184 within a group are leaf categories that directly represent data values
1185 for a variable (e.g. in a frequency table or crosstabulation, a group
1186 of values in a variable being tabulated) and i0 otherwise.
1188 @node SPV Light Member Data
1191 The final part of an SPV light member contains the actual data.
1196 int[@t{layers}] int[@t{rows}] int[@t{columns}] int*[@t{n-dimensions}]
1197 int[@t{n-data}] Datum*[@t{n-data}]
1198 Datum @result{} int64[@t{index}] v1(00?) Value
1202 The values of @code{n-layers}, @code{n-rows}, and @code{n-columns}
1203 each specifies the number of dimensions displayed in layers, rows, and
1204 columns, respectively. Any of them may be zero. Their values sum to
1205 @code{n-dimensions} from Dimensions (@pxref{SPV Light Member
1208 The @code{n-dimensions} integers are a permutation of the 0-based
1209 dimension numbers. The first @code{n-layers} integers specify each of
1210 the dimensions represented by layers, the next @code{n-rows} integers
1211 specify the dimensions represented by rows, and the final
1212 @code{n-columns} integers specify the dimensions represented by
1213 columns. When there is more than one dimension of a given kind, the
1214 inner dimensions are given first.
1216 The format of a Datum varies slightly from version 1 to version 3: in
1217 version 1 it allows for an extra optional 00 byte.
1219 A Datum consists of an @code{index} and a Value. Suppose there are
1220 @math{d} dimensions and dimension @math{i}, @math{0 \le i < d}, has
1221 @math{n_i} categories. Consider the datum at coordinates @math{x_i},
1222 @math{0 \le i < d}, and note that @math{0 \le x_i < n_i}. Then the
1223 index is calculated by the following algorithm:
1227 for each @math{i} from 0 to @math{d - 1}:
1228 @i{index} = (@math{n_i \times} @i{index}) @math{+} @math{x_i}
1231 For example, suppose there are 3 dimensions with 3, 4, and 5
1232 categories, respectively. The datum at coordinates (1, 2, 3) has
1233 index @math{5 \times (4 \times (3 \times 0 + 1) + 2) + 3 = 33}.
1234 Within a given dimension, the index is the @code{cat-index} in a Leaf.
1236 @node SPV Light Member Value
1239 Value is used throughout the SPV light member format. It boils down
1240 to a number or a string.
1244 Value @result{} 00? 00? 00? 00? RawValue
1246 01 ValueMod int[@t{format}] double[@t{x}]
1247 @math{|} 02 ValueMod int[@t{format}] double[@t{x}]
1248 string[@t{varname}] string[@t{vallab}] (01 @math{|} 02 @math{|} 03)
1249 @math{|} 03 string[@t{local}] ValueMod string[@t{id}] string[@t{c}] bool[@t{type}]
1250 @math{|} 04 ValueMod int[@t{format}] string[@t{vallab}] string[@t{varname}]
1251 (01 @math{|} 02 @math{|} 03) string[@t{s}]
1252 @math{|} 05 ValueMod string[@t{varname}] string[@t{varlabel}] (01 @math{|} 02 @math{|} 03)
1253 @math{|} ValueMod string[@t{format}] int[@t{n-args}] Argument*[@t{n-args}]
1256 @math{|} int[@t{x}] i0 Value*[@t{x}@math{+}1] /* @t{x} @math{>} 0 */
1260 There are several possible encodings, which one can distinguish by the
1261 first nonzero byte in the encoding.
1265 The numeric value @code{x}, intended to be presented to the user
1266 formatted according to @code{format}, which is in the format described
1267 for system files. @xref{System File Output Formats}, for details.
1268 Most commonly, @code{format} has width 40 (the maximum).
1270 An @code{x} with the maximum negative double value @code{-DBL_MAX}
1271 represents the system-missing value SYSMIS. (HIGHEST and LOWEST have
1272 not been observed.) @xref{System File Format}, for more about these
1276 Similar to @code{01}, with the additional information that @code{x} is
1277 a value of variable @code{varname} and has value label @code{vallab}.
1278 Both @code{varname} and @code{vallab} can be the empty string, the
1279 latter very commonly.
1281 The meaning of the final byte is unknown. Possibly it is connected to
1282 whether the value or the label should be displayed.
1285 A text string, in two forms: @code{c} is in English, and sometimes
1286 abbreviated or obscure, and @code{local} is localized to the user's
1287 locale. In an English-language locale, the two strings are often the
1288 same, and in the cases where they differ, @code{local} is more
1289 appropriate for a user interface, e.g.@: @code{c} of ``Not a PxP table
1290 for MCN...'' versus @code{local} of ``Computed only for a PxP table,
1291 where P must be greater than 1.''
1293 @code{c} and @code{local} are always either both empty or both
1296 @code{id} is a brief identifying string whose form seems to resemble a
1297 programming language identifier, e.g.@: @code{cumulative_percent} or
1298 @code{factor_14}. It is not unique.
1300 @code{type} is 00 for text taken from user input, such as syntax
1301 fragment, expressions, file names, data set names, and 01 for fixed
1302 text strings such as names of procedures or statistics. In the former
1303 case, @code{id} is always the empty string; in the latter case,
1304 @code{id} is still sometimes empty.
1307 The string value @code{s}, intended to be presented to the user
1308 formatted according to @code{format}. The format for a string is not
1309 too interesting, and the corpus contains many clearly invalid formats
1310 like A16.39 or A255.127 or A134.1, so readers should probably ignore
1311 the format entirely.
1313 @code{s} is a value of variable @code{varname} and has value label
1314 @code{vallab}. @code{varname} is never empty but @code{vallab} is
1317 The meaning of the final byte is unknown.
1320 Variable @code{varname}, which is rarely observed as empty in the
1321 corpus, with variable label @code{varlabel}, which is often empty.
1323 The meaning of the final byte is unknown.
1326 (These bytes begin a ValueMod.) A format string, analogous to
1327 @code{printf}, followed by one or more Arguments, each of which has
1328 one or more values. The format string uses the following syntax:
1335 Each of these expands to the character following @samp{\\}, to escape
1336 characters that have special meaning in format strings. These are
1337 effective inside and outside the @code{[@dots{}]} syntax forms
1341 Expands to a new-line, inside or outside the @code{[@dots{}]} forms
1345 Expands to a formatted version of argument @var{i}, which must have
1346 only a single value. For example, @code{^1} expands to the first
1347 argument's @code{value}.
1349 @item [:@var{a}:]@var{i}
1350 Expands @var{a} for each of the values in @var{i}. @var{a}
1351 should contain one or more @code{^@var{j}} conversions, which are
1352 drawn from the values for argument @var{i} in order. Some examples
1357 All of the values for the first argument, concatenated.
1360 Expands to the values for the first argument, each followed by
1364 Expands to @code{@var{x} = @var{y}} where @var{x} is the second
1365 argument's first value and @var{y} is its second value. (This would
1366 be used only if the argument has two values. If there were more
1367 values, the second and third values would be directly concatenated,
1368 which would look funny.)
1371 @item [@var{a}:@var{b}:]@var{i}
1372 This extends the previous form so that the first values are expanded
1373 using @var{a} and later values are expanded using @var{b}. For an
1374 unknown reason, within @var{a} the @code{^@var{j}} conversions are
1375 instead written as @code{%@var{j}}. Some examples from the corpus:
1379 Expands to all of the values for the first argument, separated by
1382 @item [%1 = %2:, ^1 = ^2:]1
1383 Given appropriate values for the first argument, expands to @code{X =
1387 Given appropriate values, expands to @code{1, 2, 3}.
1391 The format string is localized to the user's locale.
1394 @node SPV Light Member ValueMod
1395 @subsection ValueMod
1397 A ValueMod can specify special modifications to a Value.
1402 31 i0 (i0 @math{|} i1 string[@t{subscript}])
1403 v1(00 (i1 @math{|} i2) 00 00 int 00 00)
1404 v3(count(FormatString StylePair))
1405 @math{|} 31 int[@t{n-refs}] int16*[@t{n-refs}] Format
1408 Format @result{} 00 00 count(FormatString Style 58)
1409 FormatString @result{} count((count((i0 58)?) (58 @math{|} 31 string))?)
1416 bool[@t{bold}] bool[@t{italic}] bool[@t{underline}] bool[@t{show}]
1417 string[@t{fgcolor}] string[@t{bgcolor}]
1418 string[@t{typeface}] byte[@t{size}]
1421 int[@t{halign}] int[@t{valign}] double[@t{offset}]
1422 int16[@t{left-margin}] int16[@t{right-margin}]
1423 int16[@t{top-margin}] int16[@t{bottom-margin}]
1427 A ValueMod that begins with ``31 i0'' specifies a string to append to
1428 the main text of the Value, as a subscript. The subscript text is a
1429 brief indicator, e.g.@: @samp{a} or @samp{a,b}, with its meaning
1430 indicated by the table caption. In this usage, subscripts are similar
1431 to footnotes. One apparent difference is that a Value can only
1432 reference one footnote but a subscript can list more than one letter.
1434 A ValueMod that begins with 31 followed by a nonzero ``int'' specifies
1435 a footnote or footnotes that the Value references. Footnote markers
1436 are shown appended to the main text of the Value, as superscripts.
1438 The Format, if present, is a format string for substitutions using the
1439 syntax explained previously. It appears to be an English-language
1440 version of the localized format string in the Value in which the
1443 Style and Style2, if present, change the style for this individual
1444 Value. @code{bold}, @code{italic}, and @code{underline} control the
1445 particular style. @code{fgcolor} and @code{bgcolor} are strings, such
1446 as @code{#ffffff}. The @code{size} is a font size in units of 1/96
1449 @code{halign} is 0 for center, 2 for left, 4 for right, 6 for decimal,
1450 0xffffffad for mixed. For decimal alignment, @code{offset} is the
1451 decimal point's offset from the right side of the cell, in units of
1454 @code{valign} specifies vertical alignment: 0 for center, 1 for top, 3
1457 @code{left-margin}, @code{right-margin}, @code{top-margin}, and
1458 @code{bottom-margin} are in units of 1/72 inch.
1460 @node SPV Legacy Detail Member Binary Format
1461 @section Legacy Detail Member Binary Format
1463 Whereas the light binary format represents everything about a given
1464 pivot table, the legacy binary format conceptually consists of a
1465 number of named sources, each of which consists of a number of named
1466 variables, each of which is a 1-dimensional array of numbers or
1467 strings or a mix. Thus, the legacy binary member format is quite
1470 This section uses the same context-free grammar notation as in the
1471 previous section, with the following additions:
1475 In a version 0xaf legacy member, @var{x}; in other versions, nothing.
1476 (The legacy member header indicates the version; see below.)
1479 In a version 0xb0 legacy member, @var{x}; in other versions, nothing.
1482 A legacy detail member @file{.bin} has the following overall format:
1486 LegacyBinary @result{}
1487 00 byte[@t{version}] int16[@t{n-sources}] int[@t{member-size}]
1488 Metadata*[@t{n-sources}] Data*[@t{n-sources}]
1492 @code{version} is a version number that affects the interpretation of
1493 some of the other data in the member. Versions 0xaf and 0xb0 are
1494 known. We will refer to ``version 0xaf'' and ``version 0xb0'' members
1497 A legacy member consists of @code{n-sources} data sources, each of
1498 which has Metadata and Data.
1500 @code{member-size} is the size of the legacy binary member, in bytes.
1502 The following sections go into more detail.
1505 * SPV Legacy Member Metadata::
1506 * SPV Legacy Member Data::
1509 @node SPV Legacy Member Metadata
1510 @subsection Metadata
1515 int[@t{n-data}] int[@t{n-variables}] int[@t{offset}]
1516 vAF(byte*32[@t{source-name}])
1517 vB0(byte*64[@t{source-name}] int[@t{x}])
1521 A data source has @code{n-variables} variables, each with
1522 @code{n-data} data values.
1524 @code{source-name} is a 32- or 64-byte string padded on the right with
1525 zero bytes. The names that appear in the corpus are very generic:
1526 usually @code{tableData} for pivot table data or @code{source0} for
1529 A given Metadata's @code{offset} is the offset, in bytes, from the
1530 beginning of the member to the start of the corresponding Data. This
1531 allows programs to skip to the beginning of the data for a particular
1532 source; it is also important to determine whether a source includes
1533 any string data (@pxref{SPV Legacy Member Data}).
1535 The meaning of @code{x} in version 0xb0 is unknown.
1537 @node SPV Legacy Member Data
1542 Data @result{} NumericData*[@t{n-variables}] StringData?
1543 NumericData @result{} byte*288[@t{variable-name}] double*[@t{n-data}]
1547 Data follow the Metadata in the legacy binary format, with sources in
1548 the same order. Each NumericSeries begins with a @code{variable-name}
1549 that generally indicates its role in the pivot table, e.g.@: ``cell'',
1550 ``cellFormat'', ``dimension0categories'', ``dimension0group0'',
1551 followed by the numeric data, one double per datum. A double with the
1552 maximum negative double @code{-DBL_MAX} represents the system-missing
1557 StringData @result{} i1 string[@t{source-name}] Pairs Labels
1559 Pairs @result{} int[@t{n-string-vars}] PairSeries*[@t{n-string-vars}]
1560 PairVar @result{} string[@t{pair-var-name}] int[@t{n-pairs}] Pair*[@t{n-pairs}]
1561 Pair @result{} int[@t{i}] int[@t{j}]
1563 Labels @result{} int[@t{n-labels}] Label*[@t{n-labels}]
1564 Label @result{} int[@t{frequency}] int[@t{s}]
1568 A source may include a mix of numeric and string data values. When a
1569 source includes any string data, the data values that are strings are
1570 set to SYSMIS in the NumericData, and StringData follows the
1571 NumericData. A source that contains no string data omits the
1572 StringData. To reliably determine whether a source includes
1573 StringData, the reader should check whether the offset following the
1574 NumericData is the offset of the next source, as indicated by its
1575 Metadata (or the end of the member, in the case of the last source).
1577 StringData repeats the name of the source (from Metadata).
1579 The string data overlays the numeric data. @code{n-string-vars} is
1580 the number of variables in the source that include string data. More
1581 precisely, it is the 1-based index of the last variable in the source
1582 that includes any string data; thus, it would be 4 if there are 5
1583 variables and only the fourth one includes string data.
1585 Each PairVar consists a sequence of 0 or more Pair nonterminals, each
1586 of which maps from a 0-based index within variable @code{i} to a
1587 0-based label index @code{j}, e.g.@: pair @code{i} = 2, @code{j} = 3,
1588 means that the third data value (with value SYSMIS) is to be replaced
1589 by the string of the fourth Label.
1591 The labels themselves follow the pairs. The valuable part of each
1592 label is the string @code{s}. Each label also includes a
1593 @code{frequency} that reports the number of pairs that reference it
1594 (although this is not useful).
1596 @node SPV Legacy Detail Member XML Format
1597 @section Legacy Detail Member XML Format
1599 This format is still under investigation.
1601 The design of the detail XML format is not what one would end up with
1602 for describing pivot tables. This is because it is a special case
1603 of a much more general format (``visualization XML'' or ``VizML'')
1604 that can describe a wide range of visualizations. Most of this
1605 generality is overkill for tables, and so we end up with a funny
1606 subset of a general-purpose format.
1608 The important elements of the detail XML format are:
1612 Variables. Variables in detail XML roughly correspond to the
1613 dimensions in a light detail member. There is one variable for each
1614 dimension, plus one variable for each level of labeling along an axis.
1616 The bulk of variables are defined with @code{sourceVariable} elements.
1617 The data for these variables comes from the associated
1618 @code{tableData.bin} member. Some variables are defined, with
1619 @code{derivedVariable} elements, as a constant or in terms of a
1620 mapping function from a source variable.
1623 Assignment of variables to axes. A variable can appear as columns, or
1624 rows, or layers. The @code{faceting} element and its sub-elements
1625 describe this assignment.
1628 All elements have an optional @code{id} attribute. In practice many
1629 elements are assigned @code{id} attributes that are never referenced.
1632 * SPV Detail visualization Element::
1633 * SPV Detail userSource Element::
1634 * SPV Detail sourceVariable Element::
1635 * SPV Detail derivedVariable Element::
1636 * SPV Detail extension Element::
1637 * SPV Detail graph Element::
1638 * SPV Detail location Element::
1639 * SPV Detail coordinates Element::
1640 * SPV Detail faceting Element::
1641 * SPV Detail facetLayout Element::
1642 * SPV Detail style Element::
1645 @node SPV Detail visualization Element
1646 @subsection The @code{visualization} Element
1649 Parent: Document root
1653 (sourceVariable @math{|} derivedVariable)@math{+}
1661 This element has the following attributes.
1663 @defvr {Required} creator
1664 The version of the software that created this SPV file, as a string of
1665 the form @code{xxyyzz}, which represents software version xx.yy.zz,
1666 e.g.@: @code{160001} is version 16.0.1. The corpus includes major
1667 versions 16 through 19.
1670 @defvr {Required} date
1671 The date on the which the file was created, as a string of the form
1675 @defvr {Required} lang
1676 The locale used for output, in Windows format, which is similar to the
1677 format used in Unix with the underscore replaced by a hyphen, e.g.@:
1678 @code{en-US}, @code{en-GB}, @code{el-GR}, @code{sr-Cryl-RS}.
1681 @defvr {Required} name
1682 The title of the pivot table, localized to the output language.
1685 @defvr {Required} style
1686 The @code{id} of a @code{style} element (@pxref{SPV Detail style
1687 Element}). This is the base style for the entire pivot table. In
1688 every example in the corpus, the value is @code{visualizationStyle}
1689 and the corresponding @code{style} element has no attributes other
1693 @defvr {Required} type
1694 A floating-point number. The meaning is unknown.
1697 @defvr {Required} version
1698 The visualization schema version number. In the corpus, the value is
1699 one of 2.4, 2.5, 2.7, and 2.8.
1702 @node SPV Detail userSource Element
1703 @subsection The @code{userSource} Element
1705 Parent: @code{visualization} @*
1708 This element has the following attributes.
1710 @defvr {Optional} missing
1711 Always @code{listwise}.
1714 @node SPV Detail sourceVariable Element
1715 @subsection The @code{sourceVariable} Element
1717 Parent: @code{visualization} @*
1718 Contents: @code{extension}* (@code{format} @math{|} @code{stringFormat})?
1720 This element defines a variable whose values can be used elsewhere in
1721 the visualization. It ties this element's @code{id} to a variable
1722 from the @file{tableData.bin} member that corresponds to this
1725 This element has the following attributes.
1727 @defvr {Required} categorical
1728 Always set to @code{true}.
1731 @defvr {Required} source
1732 Always set to @code{tableData}, the @code{source-name} in the
1733 corresponding @file{tableData.bin} member (@pxref{SPV Legacy Member
1737 @defvr {Required} sourceName
1738 The name of a variable within the source, the @code{variable-name} in
1739 the corresponding @file{tableData.bin} member (@pxref{SPV Legacy
1743 @defvr {Optional} dependsOn
1744 The @code{variable-name} of a variable linked to this one, so that a
1745 viewer can work with them together. For a group variable, this is the
1746 name of the corresponding categorical variable.
1749 @defvr {Optional} label
1750 The variable label, if any
1753 @defvr {Optional} labelVariable
1754 The @code{variable-name} of a variable whose string values correspond
1755 one-to-one with the values of this variable and are suitable for use
1759 @node SPV Detail derivedVariable Element
1760 @subsection The @code{derivedVariable} Element
1762 Parent: @code{visualization} @*
1763 Contents: @code{extension}* (@code{format} @math{|} @code{stringFormat} @code{valueMapEntry}*)
1765 Like @code{sourceVariable}, this element defines a variable whose
1766 values can be used elsewhere in the visualization. Instead of being
1767 read from a data source, the variable's data are defined by a
1768 mathematical expression.
1770 This element has the following attributes.
1772 @defvr {Required} categorical
1773 Always set to @code{true}.
1776 @defvr {Required} value
1777 An expression that defines the variable's value. In theory this could
1778 be an arbitrary expression in terms of constants, functions, and other
1779 variables, e.g.@: @math{(@var{var1} + @var{var2}) / 2}. In practice,
1780 the corpus contains only the following forms of expressions:
1783 @item constant(@var{number})
1784 @itemx constant(@var{variable})
1785 A constant. The meaning when a variable is named is unknown.
1786 Sometimes the ``variable name'' has spaces in it.
1788 @item map(@var{variable})
1789 Transforms the values in the named @var{variable} using the
1790 @code{valueMapEntry}s contained within the element.
1794 @defvr {Optional} dependsOn
1795 The @code{variable-name} of a variable linked to this one, so that a
1796 viewer can work with them together. For a group variable, this is the
1797 name of the corresponding categorical variable.
1801 * SPV Detail valueMapEntry Element::
1804 @node SPV Detail valueMapEntry Element
1805 @subsubsection The @code{valueMapEntry} Element
1807 Parent: @code{derivedVariable} @*
1810 A @code{valueMapEntry} element defines a mapping from one or more
1811 values of a source expression to a target value. (In the corpus, the
1812 source expression is always just the name of a variable.) Each target
1813 value requires a separate @code{valueMapEntry}. If multiple source
1814 values map to the same target value, they can be combined or separate.
1816 @code{valueMapEntry} has the following attributes.
1818 @defvr {Required} from
1819 A source value, or multiple source values separated by semicolons,
1820 e.g.@: @code{0} or @code{13;14;15;16}.
1823 @defvr {Required} to
1827 @node SPV Detail extension Element
1828 @subsection The @code{extension} Element
1830 This is a general-purpose ``extension'' element. Readers that don't
1831 understand a given extension should be able to safely ignore it. The
1832 attributes on this element, and their meanings, vary based on the
1833 context. Each known usage is described separately below. The current
1834 extensions use attributes exclusively, without any nested elements.
1836 @subsubheading @code{visualization} Parent Element
1838 With @code{visualization} as its parent element, @code{extension} has
1839 the following attributes.
1841 @defvr {Optional} numRows
1842 An integer that presumably defines the number of rows in the displayed
1846 @defvr {Optional} showGridline
1847 Always set to @code{false} in the corpus.
1850 @defvr {Optional} minWidthSet
1851 @defvrx {Optional} maxWidthSet
1852 Always set to @code{true} in the corpus.
1855 @subsubheading @code{container} Parent Element
1857 With @code{container} as its parent element, @code{extension} has the
1858 following attributes.
1860 @defvr {Required} combinedFootnotes
1861 Always set to @code{true} in the corpus.
1864 @subsubheading @code{sourceVariable} and @code{derivedVariable} Parent Element
1866 With @code{sourceVariable} or @code{derivedVariable} as its parent
1867 element, @code{extension} has the following attributes. A given
1868 parent element often contains several @code{extension} elements that
1869 specify the meaning of the source data's variables or sources, e.g.@:
1872 <extension from="0" helpId="corrected_model"/>
1873 <extension from="3" helpId="error"/>
1874 <extension from="4" helpId="total_9"/>
1875 <extension from="5" helpId="corrected_total"/>
1878 @defvr {Required} from
1879 An integer or a name like ``dimension0''.
1882 @defvr {Required} helpId
1886 @node SPV Detail graph Element
1887 @subsection The @code{graph} Element
1889 Parent: @code{visualization} @*
1890 Contents: @code{location}@math{+} @code{coordinates} @code{faceting} @code{facetLayout} @code{interval}
1892 @code{graph} has the following attributes.
1894 @defvr {Required} cellStyle
1895 @defvrx {Required} style
1896 Each of these is the @code{id} of a @code{style} element (@pxref{SPV
1897 Detail style Element}). The former is the default style for
1898 individual cells, the latter for the entire table.
1901 @node SPV Detail location Element
1902 @subsection The @code{location} Element
1904 Parent: @code{graph} @*
1907 Each instance of this element specifies where some part of the table
1908 frame is located. All the examples in the corpus have four instances
1909 of this element, one for each of the parts @code{height},
1910 @code{width}, @code{left}, and @code{top}. Some examples in the
1911 corpus add a fifth for part @code{bottom}, even though it is not clear
1912 how all of @code{top}, @code{bottom}, and @code{heigth} can be honored
1913 at the same time. In any case, @code{location} seems to have little
1914 importance in representing tables; a reader can safely ignore it.
1916 @defvr {Required} part
1917 One of @code{height}, @code{width}, @code{top}, @code{bottom}, or
1918 @code{left}. Presumably @code{right} is acceptable as well but the
1919 corpus contains no examples.
1922 @defvr {Required} method
1923 How the location is determined:
1927 Based on the natural size of the table. Observed only for
1928 parts @code{height} and @code{width}.
1931 Based on the location specified in @code{target}. Observed only for
1932 parts @code{top} and @code{bottom}.
1935 Using the value in @code{value}. Observed only for parts @code{top},
1936 @code{bottom}, and @code{left}.
1939 Same as the specified @code{target}. Observed only for part
1944 @defvr {Optional} min
1945 Minimum size. Only observed with value @code{100pt}. Only observed
1946 for part @code{width}.
1949 @defvr {Dependent} target
1950 Required when @code{method} is @code{attach} or @code{same}, not
1951 observed otherwise. This is the ID of an element to attach to.
1952 Observed with the ID of @code{title}, @code{footnote}, @code{graph},
1956 @defvr {Dependent} value
1957 Required when @code{method} is @code{fixed}, not observed otherwise.
1958 Observed values are @code{0%}, @code{0px}, @code{1px}, and @code{3px}
1959 on parts @code{top} and @code{left}, and @code{100%} on part
1963 @node SPV Detail coordinates Element
1964 @subsection The @code{coordinates} Element
1966 Parent: @code{graph} @*
1969 This element is always present and always empty, with no attributes
1972 @node SPV Detail faceting Element
1973 @subsection The @code{faceting} Element
1975 Parent: @code{graph} @*
1976 Contents: @code{cross} @code{layer}*
1978 The @code{faceting} element describes the row, column, and layer
1979 structure of the table. Its @code{cross} child determines the row and
1980 column structure, and each @code{layer} child (if any) represents a
1983 @code{faceting} has no attributes (other than @code{id}).
1985 @subsubheading The @code{cross} Element
1987 Parent: @code{faceting} @*
1988 Contents: @code{nest} @code{nest}
1990 The @code{cross} element describes the row and column structure of the
1991 table. It has exactly two @code{nest} children, the first of which
1992 describes the table's rows and the second the table's columns.
1994 @code{cross} has no attributes (other than @code{id}).
1996 @subsubheading The @code{nest} Element
1998 Parent: @code{cross} @*
1999 Contents: @code{variableReference}@math{+}
2001 A given @code{nest} usually consists of one or more dimensions, each
2002 of which is represented by @code{variableReference} child elements.
2003 Minimally, a dimension has two @code{variableReference} children, one
2004 for the categories, one for the data, e.g.:
2008 <variableReference ref="dimension0categories"/>
2009 <variableReference ref="dimension0"/>
2014 Groups of categories introduce additional variable references, e.g.@:
2018 <variableReference ref="dimension0categories"/>
2019 <variableReference ref="dimension0group0"/>
2020 <variableReference ref="dimension0"/>
2025 Grouping can be hierarchical, e.g.@:
2029 <variableReference ref="dimension0categories"/>
2030 <variableReference ref="dimension0group1"/>
2031 <variableReference ref="dimension0group0"/>
2032 <variableReference ref="dimension0"/>
2037 XXX what are group maps?
2040 <nest id="nest_1973">
2041 <variableReference ref="dimension1categories"/>
2042 <variableReference ref="dimension1group1map"/>
2043 <variableReference ref="dimension1group0map"/>
2044 <variableReference ref="dimension1"/>
2047 <variableReference ref="dimension0categories"/>
2048 <variableReference ref="dimension0group0map"/>
2049 <variableReference ref="dimension0"/>
2054 A @code{nest} can contain multiple dimensions:
2058 <variableReference ref="dimension1categories"/>
2059 <variableReference ref="dimension1group0"/>
2060 <variableReference ref="dimension1"/>
2061 <variableReference ref="dimension0categories"/>
2062 <variableReference ref="dimension0"/>
2066 One @code{nest} within a given @code{cross} may have no dimensions, in
2067 which case it still has one @code{variableReference} child, which
2068 references a @code{derivedVariable} whose @code{value} attribute is
2069 @code{constant(0)}. In the corpus, such a @code{derivedVariable} has
2070 @code{row} or @code{column}, respectively, as its @code{id}.
2072 @code{nest} has no attributes (other than @code{id}).
2074 @subsubheading The @code{variableReference} Element
2076 Parent: @code{nest} @*
2079 @code{variableReference} has one attribute.
2081 @defvr {Required} ref
2082 The @code{id} of a @code{sourceVariable} or @code{derivedVariable}
2086 @subsubheading The @code{layer} Element
2088 Parent: @code{faceting} @*
2091 Each layer is represented by a pair of @code{layer} elements. The
2092 first of this pair is for a category variable, the second for the data
2096 <layer value="0" variable="dimension0categories" visible="true"/>
2097 <layer value="dimension0" variable="dimension0" visible="false"/>
2101 @code{layer} has the following attributes.
2103 @defvr {Required} variable
2104 The @code{id} of a @code{sourceVariable} or @code{derivedVariable}
2108 @defvr {Required} value
2109 The value to select. For a category variable, this is always
2110 @code{0}; for a data variable, it is the same as the @code{variable}
2114 @defvr {Optional} visible
2115 Whether the layer is visible. Generally, category layers are visible
2116 and data layers are not, but sometimes this attribute is omitted.
2119 @defvr {Optional} method
2120 When present, this is always @code{nest}.
2123 @node SPV Detail facetLayout Element
2124 @subsection The @code{facetLayout} Element
2126 Parent: @code{graph} @*
2127 Contents: @code{tableLayout} @code{facetLevel}@math{+} @code{setCellProperties}*
2129 @subsubheading The @code{tableLayout} Element
2131 Parent: @code{facetLayout} @*
2134 @defvr {Required} verticalTitlesInCorner
2135 Always set to @code{true}.
2138 @defvr {Optional} style
2139 The @code{id} of a @code{style} element.
2142 @defvr {Optional} fitCells
2143 Always set to @code{ticks}.
2146 @subsubheading The @code{facetLevel} Element
2148 Parent: @code{facetLayout} @*
2149 Contents: @code{axis}
2151 Each @code{facetLevel} describes a @code{variableReference} or
2152 @code{layer}, and a table has one @code{facetLevel} element for
2153 each such element. For example, an SPV detail member that contains
2154 four @code{variableReference} elements and two @code{layer} elements
2155 will contain six @code{facetLevel} elements.
2157 In the corpus, @code{facetLevel} elements and the elements that they
2158 describe are always in the same order. The correspondence may also be
2159 observed in two other ways. First, one may use the @code{level}
2160 attribute, described below. Second, in the corpus, a
2161 @code{facetLevel} always has an @code{id} that is the same as the
2162 @code{id} of the element it describes with @code{_facetLevel}
2163 appended. One should not formally rely on this, of course, but it is
2164 usefully indicative.
2166 @defvr {Required} level
2167 A 1-based index into the @code{variableReference} and @code{layer}
2168 elements, e.g.@: a @code{facetLayout} with a @code{level} of 1
2169 describes the first @code{variableReference} in the SPV detail member,
2170 and in a member with four @code{variableReference} elements, a
2171 @code{facetLayout} with a @code{level} of 5 describes the first
2172 @code{layer} in the member.
2175 @defvr {Required} gap
2176 Always observed as @code{0pt}.
2179 @subsubheading The @code{axis} Element
2181 Parent: @code{facetLevel} @*
2182 Contents: @code{label}? @code{majorTicks}
2184 @defvr {Attribute} style
2185 The @code{id} of a @code{style} element.
2188 @subsubheading The @code{label} Element
2190 Parent: @code{axis} or @code{labelFrame} @*
2191 Contents: @code{text}@math{+} @math{|} @code{descriptionGroup}
2193 This element represents a label on some aspect of the table. For example,
2194 the table's title is a @code{label}.
2196 The contents of the label can be one or more @code{text} elements or a
2197 @code{descriptionGroup}.
2199 @defvr {Attribute} style
2200 @defvrx {Optional} textFrameStyle
2201 Each of these is the @code{id} of a @code{style} element.
2202 @code{style} is the style of the label text, @code{textFrameStyle} the
2203 style for the frame around the label.
2206 @defvr {Optional} purpose
2207 The kind of entity being labeled, one of @code{title},
2208 @code{subTitle}, @code{layer}, or @code{footnote}.
2211 @subsubheading The @code{descriptionGroup} Element
2213 Parent: @code{label} @*
2214 Contents: (@code{description} @math{|} @code{text})@math{+}
2216 A @code{descriptionGroup} concatenates one or more elements to form a
2217 label. Each element can be a @code{text} element, which contains
2218 literal text, or a @code{description} element that substitutes a value
2221 @defvr {Attribute} target
2222 The @code{id} of an element being described. In the corpus, this is
2223 always @code{faceting}.
2226 @defvr {Attribute} separator
2227 A string to separate the description of multiple groups, if the
2228 @code{target} has more than one. In the corpus, this is always a
2232 Typical contents for a @code{descriptionGroup} are a value by itself:
2234 <description name="value"/>
2236 @noindent or a variable and its value, separated by a colon:
2238 <description name="variable"/><text>:</text><description name="value"/>
2241 @subsubheading The @code{description} Element
2243 Parent: @code{descriptionGroup} @*
2246 A @code{description} is like a macro that expands to some property of
2247 the target of its parent @code{descriptionGroup}.
2249 @defvr {Attribute} name
2250 The name of the property. Only @code{variable} and @code{value}
2251 appear in the corpus.
2254 @subsubheading The @code{majorTicks} Element
2256 Parent: @code{axis} @*
2257 Contents: @code{gridline}?
2259 @defvr {Attribute} labelAngle
2260 @defvrx {Attribute} length
2261 Both always defined to @code{0}.
2264 @defvr {Attribute} style
2265 @defvrx {Attribute} tickFrameStyle
2266 Each of these is the @code{id} of a @code{style} element.
2267 @code{style} is the style of the tick labels, @code{tickFrameStyle}
2268 the style for the frames around the labels.
2271 @subsubheading The @code{gridline} Element
2273 Parent: @code{majorTicks} @*
2276 Represents ``gridlines,'' which for a table represents the lines
2277 between the rows or columns of a table (XXX?).
2279 @defvr {Attribute} style
2280 The style for the gridline.
2283 @defvr {Attribute} zOrder
2284 Observed as a number between 28 and 31. Does not seem to be
2288 @subsubheading The @code{setCellProperties} Element
2290 Parent: @code{facetLayout} @*
2291 Contents: @code{setMetaData} @code{setStyle}* @code{setFormat}@math{+} @code{union}?
2293 This element sets style properties of cells designated by the
2294 @code{target} attribute of its child elements, as further restricted
2295 by the optional @code{union} element if present. The @code{target}
2296 values often used, e.g.@: @code{graph} or @code{labeling}, actually
2297 affect every cell, so the @code{union} element is a useful
2300 @defvr {Optional} applyToConverse
2301 If present, always @code{true}. This appears to invert the meaning of
2302 the @code{target} of sub-elements: the selected cells are the ones
2303 @emph{not} designated by @code{target}. This is confusing, given the
2304 additional restrictions of @code{union}, but in the corpus
2305 @code{applyToConverse} is never present along with @code{union}.
2308 @subsubheading The @code{setMetaData} Element
2310 Parent: @code{setCellProperties} @*
2313 This element is not known to have any visible effect.
2315 @defvr {Required} target
2316 The @code{id} of an element whose metadata is to be set. In the
2317 corpus, this is always @code{graph}, the @code{id} used for the
2318 @code{graph} element.
2321 @defvr {Required} key
2322 @defvrx {Required} value
2323 A key-value pair to set for the target.
2325 In the corpus, @code{key} is @code{cellPropId} or, rarely,
2326 @code{diagProps}, and @code{value} is always the @code{id} of the
2327 parent @code{setCellProperties}.
2330 @subsubheading The @code{setStyle} Element
2332 Parent: @code{setCellProperties} @*
2335 This element associates a style with the target.
2337 @defvr {Required} target
2338 The @code{id} of an element whose style is to be set. In the corpus,
2339 this is always the @code{id} of an @code{interval}, @code{labeling},
2340 or, rarely, @code{graph} element.
2343 @defvr {Required} style
2344 The @code{id} of a @code{style} element that identifies the style to
2348 @subsubheading The @code{setFormat} Element
2351 Parent: @code{setCellProperties}
2354 @math{|} @code{numberFormat}
2355 @math{|} @code{stringFormat}@math{+}
2356 @math{|} @code{dateTimeFormat}
2359 This element sets the format of the target, ``format'' in this case
2360 meaning the SPSS print format for a variable.
2362 The details of this element vary depending on the schema version, as
2363 declared in the root @code{visualization} element's @code{version}
2364 attribute (@pxref{SPV Detail visualization Element}). In version 2.5
2365 and earlier, @code{setFormat} contains one of a number of child
2366 elements that correspond to the different varieties of print formats.
2367 In version 2.7 and later, @code{setFormat} instead always contains a
2368 @code{format} element.
2370 XXX reinvestigate the above claim about versions: it appears to be
2373 The @code{setFormat} element itself has the following attributes.
2375 @defvr {Required} target
2376 The @code{id} of an element whose style is to be set. In the corpus,
2377 this is always the @code{id} of an @code{majorTicks} or
2378 @code{labeling} element.
2381 @defvr {Optional} reset
2382 If this is @code{true}, this format overrides the target's previous
2383 format. If it is @code{false}, the adds to the previous format. In
2384 the corpus this is always @code{true}. The default behavior is
2389 * SPV Detail format Element::
2390 * SPV Detail numberFormat Element::
2391 * SPV Detail stringFormat Element::
2392 * SPV Detail dateTimeFormat Element::
2393 * SPV Detail affix Element::
2394 * SPV Detail relabel Element::
2395 * SPV Detail union Element::
2398 @node SPV Detail format Element
2399 @subsubsection The @code{format} Element
2401 Parent: @code{sourceVariable}, @code{derivedVariable}, @code{formatMapping}, @code{labeling}, @code{formatMapping}, @code{setFormat} @*
2402 Contents: (@code{affix}@math{+} @math{|} @code{relabel}@math{+})?
2404 This element appears only in schema version 2.7 (@pxref{SPV Detail
2405 visualization Element}).
2407 This element determines a format, equivalent to an SPSS print format.
2409 @subsubheading Attributes for All Formats
2411 These attributes apply to all kinds of formats. The most important of
2412 these attributes determines the high-level kind of formatting in use:
2414 @defvr {Optional} baseFormat
2415 Either @code{dateTime} or @code{elapsedTime}. When this attribute is
2416 omitted, this element is a numeric or string format.
2420 Whether, in the corpus, other attributes are always present (``yes''),
2421 never present (``no''), or sometimes present (``opt'') depends on
2424 @multitable {maximumFractionDigits} {@code{dateTime}} {@code{elapsedTime}} {number} {string}
2425 @headitem Attribute @tab @code{dateTime} @tab @code{elapsedTime} @tab number @tab string
2426 @item errorCharacter @tab yes @tab yes @tab yes @tab opt
2428 @item separatorChars @tab yes @tab no @tab no @tab no
2430 @item mdyOrder @tab yes @tab no @tab no @tab no
2432 @item showYear @tab yes @tab no @tab no @tab no
2433 @item yearAbbreviation @tab yes @tab no @tab no @tab no
2435 @item showMonth @tab yes @tab no @tab no @tab no
2436 @item monthFormat @tab yes @tab no @tab no @tab no
2438 @item showDay @tab yes @tab opt @tab no @tab no
2439 @item dayPadding @tab yes @tab opt @tab no @tab no
2440 @item dayOfMonthPadding @tab yes @tab no @tab no @tab no
2441 @item dayType @tab yes @tab no @tab no @tab no
2443 @item showHour @tab yes @tab opt @tab no @tab no
2444 @item hourFormat @tab yes @tab opt @tab no @tab no
2445 @item hourPadding @tab yes @tab yes @tab no @tab no
2447 @item showMinute @tab yes @tab yes @tab no @tab no
2448 @item minutePadding @tab yes @tab yes @tab no @tab no
2450 @item showSecond @tab yes @tab yes @tab no @tab no
2451 @item secondPadding @tab no @tab yes @tab no @tab no
2453 @item showMillis @tab no @tab yes @tab no @tab no
2455 @item minimumIntegerDigits @tab no @tab no @tab yes @tab no
2456 @item maximumFractionDigits @tab no @tab yes @tab yes @tab no
2457 @item minimumFractionDigits @tab no @tab yes @tab yes @tab no
2458 @item useGrouping @tab no @tab opt @tab yes @tab no
2459 @item scientific @tab no @tab no @tab yes @tab no
2460 @item small @tab no @tab no @tab opt @tab no
2461 @item suffix @tab no @tab no @tab opt @tab no
2463 @item tryStringsAsNumbers @tab no @tab no @tab no @tab yes
2467 @defvr {Attribute} errorCharacter
2468 A character that replaces the formatted value when it cannot otherwise
2469 be represented in the given format. Always @samp{*}.
2472 @subsubheading Date and Time Attributes
2474 These attributes are used with @code{dateTime} and @code{elapsedTime}
2477 @defvr {Attribute} separatorChars
2478 Exactly four characters. In order, these are used for: decimal point,
2479 grouping, date separator, time separator. Always @samp{.,-:}.
2482 @defvr {Attribute} mdyOrder
2483 Within a date, the order of the days, months, and years.
2484 @code{dayMonthYear} is the only observed value, but one would expect
2485 that @code{monthDayYear} and @code{yearMonthDay} to be reasonable as
2489 @defvr {Attribute} showYear
2490 @defvrx {Attribute} yearAbbreviation
2491 Whether to include the year and, if so, whether the year should be
2492 shown abbreviated, that is, with only 2 digits. Each is @code{true}
2493 or @code{false}; only values of @code{true} and @code{false},
2494 respectively, have been observed.
2497 @defvr {Attribute} showMonth
2498 @defvrx {Attribute} monthFormat
2499 Whether to include the month (@code{true} or @code{false}) and, if so,
2500 how to format it. @code{monthFormat} is one of the following:
2504 The full name of the month, e.g.@: in an English locale,
2508 The abbreviated name of the month, e.g.@: in an English locale,
2512 The number representing the month, e.g.@: 9 for September.
2515 A two-digit number representing the month, e.g.@: 09 for September.
2518 Only values of @code{true} and @code{short}, respectively, have been
2522 @defvr {Attribute} dayPadding
2523 @defvrx {Attribute} dayOfMonthPadding
2524 @defvrx {Attribute} hourPadding
2525 @defvrx {Attribute} minutePadding
2526 @defvrx {Attribute} secondPadding
2527 These attributes presumably control whether each field in the output
2528 is padded with spaces to its maximum width, but the details are not
2529 understood. The only observed value for any of these attributes is
2533 @defvr {Attribute} showDay
2534 @defvrx {Attribute} showHour
2535 @defvrx {Attribute} showMinute
2536 @defvrx {Attribute} showSecond
2537 @defvrx {Attribute} showMillis
2538 These attributes presumably control whether each field is displayed
2539 in the output, but the details are not understood. The only
2540 observed value for any of these attributes is @code{true}.
2543 @defvr {Attribute} dayType
2544 This attribute is always @code{month} in the corpus, specifying that
2545 the day of the month is to be displayed; a value of @code{year} is
2546 supposed to indicate that the day of the year, where 1 is January 1,
2547 is to be displayed instead.
2550 @defvr {Attribute} hourFormat
2551 @code{hourFormat}, if present, is one of:
2555 The time is displayed with an @code{am} or @code{pm} suffix, e.g.@:
2559 The time is displayed in a 24-hour format, e.g.@: @code{22:15}.
2561 This is the only value observed in the corpus.
2564 The time is displayed in a 12-hour format, without distinguishing
2565 morning or evening, e.g.@: @code{10;15}.
2568 @code{hourFormat} is sometimes present for @code{elapsedTime} formats,
2569 which is confusing since a time duration does not have a concept of AM
2570 or PM. This might indicate a bug in the code that generated the XML
2571 in the corpus, or it might indicate that @code{elapsedTime} is
2572 sometimes used to format a time of day.
2575 @subsubheading Numeric Attributes
2577 These attributes are used for formats when @code{baseFormat} is
2578 @code{number}. Attributes @code{maximumFractionDigits}, and
2579 @code{minimumFractionDigits}, and @code{useGrouping} are also used
2580 when @code{baseFormat} is @code{elapsedTime}.
2582 @defvr {Attribute} minimumIntegerDigits
2583 Minimum number of digits to display before the decimal point. Always
2584 observed as @code{0}.
2587 @defvr {Attribute} maximumFractionDigits
2588 @defvrx {Attribute} maximumFractionDigits
2589 Maximum or minimum, respectively, number of digits to display after
2590 the decimal point. The observed values of each attribute range from 0
2594 @defvr {Attribute} useGrouping
2595 Whether to use the grouping character to group digits in large
2596 numbers. It would make sense for the grouping character to come from
2597 the @code{separatorChars} attribute, but that attribute is only
2598 present when @code{baseFormat} is @code{dateTime} or
2599 @code{elapsedTime}, in the corpus at least. Perhaps that is because
2600 this attribute has only been observed as @code{false}.
2603 @defvr {Attribute} scientific
2604 This attribute controls when and whether the number is formatted in
2605 scientific notation. It takes the following values:
2609 Use scientific notation only when the number's magnitude is smaller
2610 than the value of the @code{small} attribute.
2613 Use scientific notation when the number will not otherwise fit in the
2617 Always use scientific notation. Not observed in the corpus.
2620 Never use scientific notation. A number that won't otherwise fit will
2621 be replaced by an error indication (see the @code{errorCharacter}
2622 attribute). Not observed in the corpus.
2626 @defvr {Optional} small
2627 Only present when the @code{scientific} attribute is
2628 @code{onlyForSmall}, this is a numeric magnitude below which the
2629 number will be formatted in scientific notation. The values @code{0}
2630 and @code{0.0001} have been observed. The value @code{0} seems like a
2631 pathological choice, since no real number has a magnitude less than 0;
2632 perhaps in practice such a choice is equivalent to setting
2633 @code{scientific} to @code{false}.
2636 @defvr {Optional} prefix
2637 @defvrx {Optional} suffix
2638 Specifies a prefix or a suffix to apply to the formatted number. Only
2639 @code{suffix} has been observed, with value @samp{%}.
2642 @subsubheading String Attributes
2644 These attributes are used for formats when @code{baseFormat} is
2647 @defvr {Attribute} tryStringsAsNumbers
2648 When this is @code{true}, it is supposed to indicate that string
2649 values should be parsed as numbers and then displayed according to
2650 numeric formatting rules. However, in the corpus it is always
2654 @node SPV Detail numberFormat Element
2655 @subsubsection The @code{numberFormat} Element
2657 Parent: @code{setFormat} @*
2658 Contents: @code{affix}@math{+}
2660 This element appears only in schema version 2.5 and earlier
2661 (@pxref{SPV Detail visualization Element}). Possibly this element
2662 could also contain @code{relabel} elements in a more diverse corpus.
2664 This element has the following attributes.
2666 @defvr {Attribute} maximumFractionDigits
2667 @defvrx {Attribute} minimumFractionDigits
2668 @defvrx {Attribute} minimumIntegerDigits
2669 @defvrx {Optional} scientific
2670 @defvrx {Optional} small
2671 @defvrx {Optional} suffix
2672 @defvrx {Optional} useGroupging
2673 The syntax and meaning of these attributes is the same as on the
2674 @code{format} element for a numeric format. @pxref{SPV Detail format
2678 @node SPV Detail stringFormat Element
2679 @subsubsection The @code{stringFormat} Element
2681 Parent: @code{setFormat} @*
2682 Contents: (@code{affix}@math{+} @math{|} @code{relabel}@math{+})?
2684 This element appears only in schema version 2.5 and earlier
2685 (@pxref{SPV Detail visualization Element}).
2687 This element has no attributes.
2689 @node SPV Detail dateTimeFormat Element
2690 @subsubsection The @code{dateTimeFormat} Element
2692 Parent: @code{setFormat} @*
2695 This element appears only in schema version 2.5 and earlier
2696 (@pxref{SPV Detail visualization Element}). Possibly this element
2697 could also contain @code{affix} and @code{relabel} elements in a more
2700 The following attribute is required.
2702 @defvr {Attribute} baseFormat
2703 Either @code{dateTime} or @code{time}.
2706 When @code{baseFormat} is @code{dateTime}, the following attributes
2709 @defvr {Attribute} dayOfMonthPadding
2710 @defvrx {Attribute} dayPadding
2711 @defvrx {Attribute} dayType
2712 @defvrx {Attribute} hourFormat
2713 @defvrx {Attribute} hourPadding
2714 @defvrx {Attribute} mdyOrder
2715 @defvrx {Attribute} minutePadding
2716 @defvrx {Attribute} monthFormat
2717 @defvrx {Attribute} separatorChars
2718 @defvrx {Attribute} showDay
2719 @defvrx {Attribute} showHour
2720 @defvrx {Attribute} showMinute
2721 @defvrx {Attribute} showMonth
2722 @defvrx {Attribute} showSecond
2723 @defvrx {Attribute} showYear
2724 @defvrx {Attribute} yearAbbreviation
2725 The syntax and meaning of these attributes is the same as on the
2726 @code{format} element when that element's @code{baseFormat} is
2727 @code{dateTime}. @pxref{SPV Detail format Element}.
2730 When @code{baseFormat} is @code{time}, the following attributes are
2733 @defvr {Attribute} hourFormat
2734 @defvrx {Attribute} hourPadding
2735 @defvrx {Attribute} minutePadding
2736 @defvrx {Attribute} monthFormat
2737 @defvrx {Attribute} separatorChars
2738 @defvrx {Attribute} showDay
2739 @defvrx {Attribute} showHour
2740 @defvrx {Attribute} showMinute
2741 @defvrx {Attribute} showMonth
2742 @defvrx {Attribute} showSecond
2743 @defvrx {Attribute} showYear
2744 @defvrx {Attribute} yearAbbreviation
2745 The syntax and meaning of these attributes is the same as on the
2746 @code{format} element when that element's @code{baseFormat} is
2747 @code{elapsedTime}. @pxref{SPV Detail format Element}.
2750 @node SPV Detail affix Element
2751 @subsubsection The @code{affix} Element
2753 Parent: @code{format} or @code{numberFormat} or @code{stringFormat} @*
2756 Possibly this element could have @code{dateTimeFormat} as a parent in
2757 a more diverse corpus.
2759 This defines a suffix (or, theoretically, a prefix) for a formatted
2760 value. It is used to insert a reference to a footnote. It has the
2761 following attributes:
2763 @defvr {Attribute} definesReference
2764 This specifies the footnote number as a natural number: 1 for the
2765 first footnote, 2 for the second, and so on.
2768 @defvr {Attribute} position
2769 Position for the footnote label. Always @code{superscript}.
2772 @defvr {Attribute} suffix
2773 Whether the affix is a suffix (@code{true}) or a prefix
2774 (@code{false}). Always @code{true}.
2777 @defvr {Attribute} value
2778 The text of the suffix or prefix. Typically a letter, e.g.@: @code{a}
2779 for footnote 1, @code{b} for footnote 2, @enddots{} The corpus
2780 contains other values: @code{*}, @code{**}, and a few that begin with
2781 at least one comma: @code{,b}, @code{,c}, @code{,,b}, and @code{,,c}.
2784 @node SPV Detail relabel Element
2785 @subsubsection The @code{relabel} Element
2787 Parent: @code{format} or @code{stringFormat} @*
2790 Possibly this element could have @code{numberFormat} or
2791 @code{dateTimeFormat} as a parent in a more diverse corpus.
2793 This specifies how to display a given value. It is used to implement
2794 value labels and to display the system-missing value in a
2795 human-readable way. It has the following attributes:
2797 @defvr {Attribute} from
2798 The value to map. In the corpus this is an integer or the
2799 system-missing value @code{-1.797693134862316E300}.
2802 @defvr {Attribute} to
2803 The string to display in place of the value of @code{from}. In the
2804 corpus this is a wide variety of value labels; the system-missing
2805 value is mapped to @samp{.}.
2808 @node SPV Detail union Element
2809 @subsubsection The @code{union} Element
2811 Parent: @code{setCellProperties} @*
2812 Contents: @code{intersect}@math{+}
2814 This element represents a set of cells, computed as the union of the
2815 sets represented by each of its children.
2817 @subsubheading The @code{intersect} Element
2819 Parent: @code{union} @*
2820 Contents: @code{where}@math{+} @math{|} @code{intersectWhere}?
2822 This element represents a set of cells, computed as the intersection
2823 of the sets represented by each of its children.
2825 Of the two possible children, in the corpus @code{where} is far more
2826 common, appearing thousands of times, whereas @code{intersectWhere}
2827 only appears 4 times.
2829 Most @code{intersect} elements have two or more children.
2831 @subsubheading The @code{where} Element
2833 Parent: @code{intersect} @*
2836 This element represents the set of cells in which the value of a
2837 specified variable falls within a specified set.
2839 @defvr {Attribute} variable
2840 The @code{id} of a variable, e.g.@: @code{dimension0categories} or
2841 @code{dimension0group0map}.
2844 @defvr {Attribute} include
2845 A value, or multiple values separated by semicolons,
2846 e.g.@: @code{0} or @code{13;14;15;16}.
2849 @subsubheading The @code{intersectWhere} Element
2851 Parent: @code{intersect} @*
2854 The meaning of this element is unknown.
2856 @defvr {Attribute} variable
2857 @defvrx {Attribute} variable2
2858 The meaning of these attributes is unknown. In the four examples in
2859 the corpus they always take the values @code{dimension2categories} and
2860 @code{dimension0categories}, respectively.
2863 @node SPV Detail style Element
2864 @subsection The @code{style} Element