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 Structure members' XML files claim conformance with a collection of
84 XML Schemas. These schemas are distributed, under a nonfree license,
85 with SPSS binaries. Fortunately, the schemas are not necessary to
86 understand the structure members. To a degree, the schemas can even
87 be deceptive because they document elements and attributes that are
88 not in the corpus and do not document elements and attributes that are
91 Structure members use a different XML namespace for each schema, but
92 these namespaces are not entirely consistent. In some SPV files, for
93 example, the @code{viewer-tree} schema is associated with namespace
94 @indicateurl{http://xml.spss.com/spss/viewer-tree} and in others with
95 @indicateurl{http://xml.spss.com/spss/viewer/viewer-tree} (note the
96 additional @file{viewer/}). Under either name, the schema URIs are
97 not resolvable to obtain the schemas themselves.
99 One may ignore all of the above in interpreting a structure member.
100 The actual XML has a simple and straightforward form that does not
101 require a reader to take schemas or namespaces into account.
103 The elements found in structure members are documented below. For
104 each element, we note the possible parent elements and the element's
105 contents. The contents are specified as pseudo-regular expressions
106 with the following conventions:
119 Grouping multiple elements.
124 @item @var{a} @math{|} @var{b}
125 A choice between @var{a} and @var{b}.
128 Zero or more @var{x}.
132 For a diagram illustrating the hierarchy of elements within an SPV
133 structure member, please refer to a PDF version of the manual.
137 The following diagram shows the hierarchy of elements within an SPV
138 structure member. Edges point from parent to child elements.
139 Unlabeled edges indicate that the child appears exactly once; edges
140 labeled with *, zero or more times; edges labeled with ?, zero or one
142 @center @image{dev/spv-structure, 5in}
146 * SPV Structure heading Element::
147 * SPV Structure label Element::
148 * SPV Structure container Element::
149 * SPV Structure text Element (Inside @code{container})::
150 * SPV Structure html Element::
151 * SPV Structure table Element::
152 * SPV Structure tableStructure Element::
153 * SPV Structure dataPath Element::
154 * SPV Structure pageSetup Element::
155 * SPV Structure pageHeader and pageFooter Elements::
156 * SPV Structure pageParagraph Element::
157 * SPV Structure @code{text} Element (Inside @code{pageParagraph})::
160 @node SPV Structure heading Element
161 @subsection The @code{heading} Element
163 Parent: Document root or @code{heading} @*
164 Contents: @code{pageSetup}? @code{label} (@code{container} @math{|} @code{heading})*
166 The root of a structure member is a @code{heading}, which represents a
167 section of output beginning with a title (the @code{label}) and
168 ordinarily followed by content containers or further nested
169 (sub)-sections of output.
171 The document root heading, only, may also contain a @code{pageSetup}
174 The following attributes have been observed on both document root and
175 nested @code{heading} elements.
177 @defvr {Optional} creator-version
178 The version of the software that created this SPV file. A string of
179 the form @code{xxyyzzww} represents software version xx.yy.zz.ww,
180 e.g.@: @code{21000001} is version 21.0.0.1. Trailing pairs of zeros
181 are sometimes omitted, so that @code{21}, @code{210000}, and
182 @code{21000000} are all version 21.0.0.0 (and the corpus contains all
183 three of those forms).
187 The following attributes have been observed on document root
188 @code{heading} elements only:
190 @defvr {Optional} @code{creator}
191 The directory in the file system of the software that created this SPV
195 @defvr {Optional} @code{creation-date-time}
196 The date and time at which the SPV file was written, in a
197 locale-specific format, e.g.@: @code{Friday, May 16, 2014 6:47:37 PM
198 PDT} or @code{lunedì 17 marzo 2014 3.15.48 CET} or even @code{Friday,
199 December 5, 2014 5:00:19 o'clock PM EST}.
202 @defvr {Optional} @code{lockReader}
203 Whether a reader should be allowed to edit the output. The possible
204 values are @code{true} and @code{false}, but the corpus only contains
208 @defvr {Optional} @code{schemaLocation}
209 This is actually an XML Namespace attribute. A reader may ignore it.
213 The following attributes have been observed only on nested
214 @code{heading} elements:
216 @defvr {Required} @code{commandName}
217 The locale-invariant name of the command that produced the output,
218 e.g.@: @code{Frequencies}, @code{T-Test}, @code{Non Par Corr}.
221 @defvr {Optional} @code{visibility}
222 To what degree the output represented by the element is visible. The
223 only observed value is @code{collapsed}.
226 @defvr {Optional} @code{locale}
227 The locale used for output, in Windows format, which is similar to the
228 format used in Unix with the underscore replaced by a hyphen, e.g.@:
229 @code{en-US}, @code{en-GB}, @code{el-GR}, @code{sr-Cryl-RS}.
232 @defvr {Optional} @code{olang}
233 The output language, e.g.@: @code{en}, @code{it}, @code{es},
234 @code{de}, @code{pt-BR}.
237 @node SPV Structure label Element
238 @subsection The @code{label} Element
240 Parent: @code{heading} or @code{container} @*
243 Every @code{heading} and @code{container} holds a @code{label} as its
244 first child. The root @code{heading} in a structure member always
245 contains the string ``Output''. Otherwise, the text in @code{label}
246 describes what it labels, often by naming the statistical procedure
247 that was executed, e.g.@: ``Frequencies'' or ``T-Test''. Labels are
248 often very generic, especially within a @code{container}, e.g.@:
249 ``Title'' or ``Warnings'' or ``Notes''. Label text is localized
250 according to the output language, e.g.@: in Italian a frequency table
251 procedure is labeled ``Frequenze''.
253 The corpus contains one example of an empty label, one that contains
256 This element has no attributes.
258 @node SPV Structure container Element
259 @subsection The @code{container} Element
261 Parent: @code{heading} @*
262 Contents: @code{label} (@code{table} @math{|} @code{text})?
264 A @code{container} serves to label a @code{table} or a @code{text}
267 This element has the following attributes.
269 @defvr {Required} @code{visibility}
270 Either @code{visible} or @code{hidden}, this indicates whether the
271 container's content is displayed.
274 @defvr {Optional} @code{text-align}
275 Presumably indicates the alignment of text within the container. The
276 only observed value is @code{left}. Observed with nested @code{table}
277 and @code{text} elements.
280 @defvr {Optional} @code{width}
281 The width of the container in the form @code{@var{n}px}, e.g.@:
285 @node SPV Structure text Element (Inside @code{container})
286 @subsection The @code{text} Element (Inside @code{container})
288 Parent: @code{container} @*
289 Contents: @code{html}
291 This @code{text} element is nested inside a @code{container}. There
292 is a different @code{text} element that is nested inside a
293 @code{pageParagraph}.
295 This element has the following attributes.
297 @defvr {Required} @code{type}
298 One of @code{title}, @code{log}, or @code{text}.
301 @defvr {Optional} @code{commandName}
302 As on the @code{heading} element. For output not specific to a
303 command, this is simply @code{log}. The corpus contains one example
304 of where @code{commandName} is present but set to the empty string.
307 @defvr {Optional} @code{creator-version}
308 As on the @code{heading} element.
311 @node SPV Structure html Element
312 @subsection The @code{html} Element
314 Parent: @code{text} @*
317 The CDATA contains an HTML document. In some cases, the document
318 starts with @code{<html>} and ends with @code{</html}; in others the
319 @code{html} element is implied. Generally the HTML includes a
320 @code{head} element with a CSS stylesheet. The HTML body often begins
321 with @code{<BR>}. The actual content ranges from trivial to simple:
322 just discarding the CSS and tags yields readable results.
324 This element has the following attributes.
326 @defvr {Required} @code{lang}
327 This always contains @code{en} in the corpus.
330 @node SPV Structure table Element
331 @subsection The @code{table} Element
333 Parent: @code{container} @*
334 Contents: @code{tableStructure}
336 This element has the following attributes.
338 @defvr {Required} @code{commandName}
339 As on the @code{heading} element.
342 @defvr {Required} @code{type}
343 One of @code{table}, @code{note}, or @code{warning}.
346 @defvr {Required} @code{subType}
347 The locale-invariant name for the particular kind of output that this
348 table represents in the procedure. This can be the same as
349 @code{commandName} e.g.@: @code{Frequencies}, or different, e.g.@:
350 @code{Case Processing Summary}. Generic subtypes @code{Notes} and
351 @code{Warnings} are often used.
354 @defvr {Required} @code{tableId}
355 A number that uniquely identifies the table within the SPV file,
356 typically a large negative number such as @code{-4147135649387905023}.
359 @defvr {Optional} @code{creator-version}
360 As on the @code{heading} element. In the corpus, this is only present
361 for version 21 and up and always includes all 8 digits.
364 @node SPV Structure tableStructure Element
365 @subsection The @code{tableStructure} Element
367 Parent: @code{table} @*
368 Contents: @code{dataPath}
370 This element has no attributes.
372 @node SPV Structure dataPath Element
373 @subsection The @code{dataPath} Element
375 Parent: @code{tableStructure} @*
378 Contains the name of the Zip member that holds the table details,
379 e.g.@: @code{0000000001437_lightTableData.bin}.
381 This element has no attributes.
383 @node SPV Structure pageSetup Element
384 @subsection The @code{pageSetup} Element
386 Parent: @code{heading} @*
387 Contents: @code{pageHeader} @code{pageFooter}
389 This element has the following attributes.
391 @defvr {Required} @code{initial-page-number}
395 @defvr {Optional} @code{chart-size}
396 Always @code{as-is} or a localization (!) of it (e.g.@: @code{dimensione
397 attuale}, @code{Wie vorgegeben}).
400 @defvr {Optional} @code{margin-left}
401 @defvrx {Optional} @code{margin-right}
402 @defvrx {Optional} @code{margin-top}
403 @defvrx {Optional} @code{margin-bottom}
404 Margin sizes in the form @code{@var{size}in}, e.g.@: @code{0.25in}.
407 @defvr {Optional} @code{paper-height}
408 @defvrx {Optional} @code{paper-width}
409 Paper sizes in the form @code{@var{size}in}, e.g.@: @code{8.5in} by
410 @code{11in} for letter paper or @code{8.267in} by @code{11.692in} for
414 @defvr {Optional} @code{reference-orientation}
418 @defvr {Optional} @code{space-after}
422 @node SPV Structure pageHeader and pageFooter Elements
423 @subsection The @code{pageHeader} and @code{pageFooter} Elements
425 Parent: @code{pageSetup} @*
426 Contents: @code{pageParagraph}*
428 This element has no attributes.
430 @node SPV Structure pageParagraph Element
431 @subsection The @code{pageParagraph} Element
433 Parent: @code{pageHeader} or @code{pageFooter} @*
434 Contents: @code{text}
436 Text to go at the top or bottom of a page, respectively.
438 This element has no attributes.
440 @node SPV Structure @code{text} Element (Inside @code{pageParagraph})
441 @subsection The @code{text} Element (Inside @code{pageParagraph})
443 Parent: @code{pageParagraph}
446 This @code{text} element is nested inside a @code{pageParagraph}. There
447 is a different @code{text} element that is nested inside a
450 The element is either empty, or contains CDATA that holds almost-XHTML
451 text: in the corpus, either an @code{html} or @code{p} element. It is
452 @emph{almost}-XHTML because the @code{html} element designates the
454 @code{http://xml.spss.com/spss/viewer/viewer-tree} instead of an XHTML
455 namespace, and because the CDATA can contain substitution variables:
456 @code{&[Page]} for the page number and @code{&[PageTitle]} for the
459 Typical contents (indented for clarity):
462 <html xmlns="http://xml.spss.com/spss/viewer/viewer-tree">
465 <p style="text-align:right; margin-top: 0">Page &[Page]</p>
470 This element has the following attributes.
472 @defvr {Required} @code{type}
476 @node SPV Light Detail Member Format
477 @section Light Detail Member Format
479 This section describes the format of ``light'' detail @file{.bin}
480 members. These members have a binary format which we describe here in
481 terms of a context-free grammar using the following conventions:
484 @item NonTerminal @result{} @dots{}
485 Nonterminals have CamelCaps names, and @result{} indicates a
486 production. The right-hand side of a production is often broken
487 across multiple lines. Break points are chosen for aesthetics only
488 and have no semantic significance.
490 @item 00, 01, @dots{}, ff.
491 A bytes with a fixed value, written as a pair of hexadecimal digits.
493 @item i0, i1, @dots{}, i9, i10, i11, @dots{}
494 @itemx b0, b1, @dots{}, b9, b10, b11, @dots{}
495 A 32-bit integer in little-endian or big-endian byte order,
496 respectively, with a fixed value, written in decimal, prefixed by
503 A byte with value 0 or 1.
507 A 16-bit integer in little-endian or big-endian byte order,
512 A 32-bit integer in little-endian or big-endian byte order,
517 A 64-bit integer in little-endian or big-endian byte order,
521 A 64-bit IEEE floating-point number.
524 A 32-bit IEEE floating-point number.
528 A 32-bit integer, in little-endian or big-endian byte order,
529 respectively, followed by the specified number of bytes of character
530 data. (The encoding is indicated by the Formats nonterminal.)
533 @var{x} is optional, e.g.@: 00? is an optional zero byte.
535 @item @var{x}*@var{n}
536 @var{x} is repeated @var{n} times, e.g. byte*10 for ten arbitrary bytes.
538 @item @var{x}[@var{name}]
539 Gives @var{x} the specified @var{name}. Names are used in textual
540 explanations. They are also used, also bracketed, to indicate counts,
541 e.g.@: int[@t{n}] byte*[@t{n}] for a 32-bit integer followed by the
542 specified number of arbitrary bytes.
544 @item @var{a} @math{|} @var{b}
545 Either @var{a} or @var{b}.
548 Parentheses are used for grouping to make precedence clear, especially
549 in the presence of @math{|}, e.g.@: in 00 (01 @math{|} 02 @math{|} 03)
553 A 32-bit integer that indicates the number of bytes in @var{x},
554 followed by @var{x} itself.
557 In a version 1 @file{.bin} member, @var{x}; in version 3, nothing.
558 (The @file{.bin} header indicates the version.)
561 In a version 3 @file{.bin} member, @var{x}; in version 1, nothing.
564 Little-endian byte order is far more common in this format, but a few
565 pieces of the format use big-endian byte order.
567 A ``light'' detail member @file{.bin} consists of a number of sections
568 concatenated together, terminated by a byte 01:
572 LightMember @result{}
575 Fonts Formats Borders PrintSettings TableSettings
581 The following sections go into more detail.
584 * SPV Light Member Header::
585 * SPV Light Member Title::
586 * PSV Light Member Caption::
587 * SPV Light Member Footnotes::
588 * SPV Light Member Fonts::
589 * SPV Light Member Borders::
590 * SPV Light Member Print Settings::
591 * SPV Light Member Table Settings::
592 * SPV Light Member Formats::
593 * SPV Light Member Dimensions::
594 * SPV Light Member Categories::
595 * SPV Light Member Data::
596 * SPV Light Member Value::
597 * SPV Light Member ValueMod::
600 @node SPV Light Member Header
603 An SPV light member begins with a 39-byte header:
609 (i1 @math{|} i3)[@t{version}]
611 int[@t{min-column-width}] int[@t{max-column-width}]
612 int[@t{min-row-height}] int[@t{max-row-height}]
617 @code{version} is a version number that affects the interpretation of
618 some of the other data in the member. We will refer to ``version 1''
619 and ``version 3'' later on and use v1(@dots{}) and v3(@dots{}) for
620 version-specific formatting (as described previously).
622 @code{table-id} is a binary version of the @code{tableId} attribute in
623 the structure member that refers to the detail member. For example,
624 if @code{tableId} is @code{-4122591256483201023}, then @code{table-id}
625 would be 0xc6c99d183b300001.
627 The meaning of the other variable parts of the header is not known.
629 @node SPV Light Member Title
635 Value[@t{title1}] 01?
637 Value[@t{title2}] 01?
641 The Title, which follows the Header, specifies the pivot table's title
642 twice, as @code{title1} and @code{title2}. In the corpus, they are
645 Whereas the Value in @code{title1} and in @code{title2} are
646 appropriate for presentation, and localized to the user's language,
647 @code{c} is in English, sometimes less specific, and sometimes less
648 well formatted. For example, for a frequency table, @code{title1} and
649 @code{title2} name the variable and @code{c} is simply ``Frequencies''.
651 @node PSV Light Member Caption
656 Caption @result{} Caption1 Caption2
657 Caption1 @result{} 31 Value @math{|} 58
658 Caption2 @result{} 31 Value @math{|} 58
662 The Caption, if present, is shown below the table. Caption2 is
663 normally present. Caption1 is only rarely nonempty; it might reflect
664 user editing of the caption.
666 @node SPV Light Member Footnotes
667 @subsection Footnotes
671 Footnotes @result{} int[@t{n}] Footnote*[@t{n}]
672 Footnote @result{} Value[@t{text}] (58 @math{|} 31 Value[@t{marker}]) byte*4
676 Each footnote has @code{text} and an optional customer @code{marker}
679 @node SPV Light Member Fonts
684 Fonts @result{} 00 Font*8
687 string[@t{typeface}] float[@t{size}] int[@t{style}] bool[@t{underline}]
688 int[@t{halign}] int[@t{valign}]
689 string[@t{fgcolor}] string[@t{bgcolor}]
690 byte[@t{alternate}] string[@t{altfg}] string[@t{altbg}]
691 v3(int[@t{left-margin}] int[@t{right-margin}] int[@t{top-margin}] int[@t{bottom-margin}])
695 Each Font represents the font style for a different element, in the
696 following order: title, caption, footer, corner, column
697 labels, row labels, data, and layers.
699 @code{index} is the 1-based index of the Font, i.e. 1 for the first
700 Font, through 8 for the final Font.
702 @code{typeface} is the string name of the font. In the corpus, this
703 is @code{SansSerif} in over 99% of instances and @code{Times New
706 @code{size} is the size of the font, in points. The most common size
707 in the corpus is 12 points.
709 @code{style} is a bit mask. Bit 0 (with value 1) is set for bold, bit
710 1 (with value 2) is set for italic.
712 @code{underline} is 1 if the font is underlined, 0 otherwise.
714 @code{halign} specifies horizontal alignment: 0 for center, 2 for
715 left, 4 for right, 61453 for decimal, 64173 for mixed. Mixed
716 alignment varies according to type: string data is left-justified,
717 numbers and most other formats are right-justified.
719 @code{valign} specifies vertical alignment: 0 for center, 1 for top, 3
722 @code{fgcolor} and @code{bgcolor} are the foreground color and
723 background color, respectively. In the corpus, these are always
724 @code{#000000} and @code{#ffffff}, respectively.
726 @code{alternate} is 01 if rows should alternate colors, 00 if all rows
727 should be the same color. When @code{alternate} is 01, @code{altfg}
728 and @code{altbg} specify the colors for the alternate rows.
730 @node SPV Light Member Borders
737 be32[@t{n-borders}] Border*[@t{n-borders}]
738 bool[@t{show-grid-lines}]
742 be32[@t{border-type}]
743 be32[@t{stroke-type}]
748 The Borders reflect how borders between regions are drawn.
750 The fixed value of @code{endian} can be used to validate the
753 @code{show-grid-lines} is 1 to draw grid lines, otherwise 0.
755 Each Border describes one kind of border. @code{n-borders} seems to
756 always be 19. Each @code{border-type} appears once in order, and they
757 correspond to the following borders:
763 Left, top, right, and bottom outer frame.
765 Left, top, right, and bottom inner frame.
767 Left and top of data area.
769 Horizontal and vertical dimension rows.
771 Horizontal and vertical dimension columns.
773 Horizontal and vertical category rows.
775 Horizontal and vertical category columns.
778 @code{stroke-type} describes how a border is drawn, as one of:
795 @code{color} is an RGB color. Bits 24--31 are alpha, bits 16--23 are
796 red, 8--15 are green, 0--7 are blue. An alpha of 255 indicates an
797 opaque color, therefore opaque black is 0xff000000.
799 @node SPV Light Member Print Settings
800 @subsection Print Settings
804 PrintSettings @result{}
807 bool[@t{paginate-layers}]
810 bool[@t{top-continuation}]
811 bool[@t{bottom-continuation}]
812 be32[@t{n-orphan-lines}]
813 bestring[@t{continuation-string}]
817 The PrintSettings reflect settings for printing. The fixed value of
818 @code{endian} can be used to validate the endianness.
820 @code{layers} is 1 to print all layers, 0 to print only the visible
823 @code{paginate-layers} is 1 to print each layer at the start of a new
826 @code{fit-width} and @code{fit-length} control whether the table is
827 shrunk to fit within a page's width or length, respectively.
829 @code{n-orphan-lines} is the minimum number of rows or columns to put
830 in one part of a table that is broken across pages.
832 If @code{top-continuation} is 1, then @code{continuation-string} is
833 printed at the top of a page when a table is broken across pages for
834 printing; similarly for @code{bottom-continuation} and the bottom of a
835 page. Usually, @code{continuation-string} is empty.
837 @node SPV Light Member Table Settings
838 @subsection Table Settings
842 TableSettings @result{}
845 be32[@t{current-layer}]
847 bool[@t{show-row-labels-in-corner}]
848 bool[@t{show-alphabetic-markers}]
849 bool[@t{footnote-marker-position}]
852 be32[@t{n}] byte*[@t{n}]
854 bestring[@t{table-look}]
860 The TableSettings reflect display settings. The fixed value of
861 @code{endian} can be used to validate the endianness.
863 @code{current-layer} is the displayed layer.
865 If @code{omit-empty} is 1, empty rows or columns (ones with nothing in
866 any cell) are hidden; otherwise, they are shown.
868 If @code{show-row-labels-in-corner} is 1, then row labels are shown in
869 the upper left corner; otherwise, they are shown nested.
871 If @code{show-alphabetic-markers} is 1, markers are shown as letters
872 (e.g. @samp{a}, @samp{b}, @samp{c}, @dots{}); otherwise, they are
873 shown as numbers starting from 1.
875 When @code{footnote-marker-position} is 1, footnote markers are shown
876 as superscripts, otherwise as subscripts.
878 @code{table-look} is the name of a SPSS ``TableLook'' table style,
879 such as ``Default'' or ``Academic''; it is often empty.
881 TableSettings ends with an arbitrary number of null bytes.
883 @node SPV Light Member Formats
889 int[@t{n4}] int*[@t{n4}]
891 (i0 @math{|} i-1) (00 @math{|} 01) 00 (00 @math{|} 01)
893 byte[@t{decimal}] byte[@t{grouping}]
894 int[@t{n-ccs}] string*[@t{n-ccs}]
896 v3(count(count(X5) count(X6)))
898 X5 @result{} byte*33 int[@t{n}] int*[@t{n}]
900 01 00 (03 @math{|} 04) 00 00 00
901 string[@t{command}] string[@t{subcommand}]
902 string[@t{language}] string[@t{charset}] string[@t{locale}]
903 (00 @math{|} 01) 00 (00 @math{|} 01) (00 @math{|} 01)
905 byte[@t{decimal}] byte[@t{grouping}]
906 (2d 43 1c eb e2 36 1a 3f | 00*8) 01
907 (string[@t{dataset}] string[@t{datafile}] i0 int[@t{date}] i0)?
908 int[@t{n-ccs}] string*[@t{n-ccs}]
909 2e (00 @math{|} 01) (i2000000 i0)?
913 Observed values of @code{n4} vary from 0 to 17. Out of 7,060 examples
914 in the corpus, it is nonzero only 36 times.
916 @code{encoding} is a character encoding, usually a Windows code page
917 such as @code{en_US.windows-1252} or @code{it_IT.windows-1252}. The
918 rest of the character strings in the member use this encoding. The
919 encoding string is itself encoded in US-ASCII.
921 @code{epoch} is the year that starts the epoch. A 2-digit year is
922 interpreted as belonging to the 100 years beginning at the epoch. The
923 default epoch year is 69 years prior to the current year; thus, in
924 2017 this field by default contains 1948. In the corpus, @code{epoch}
925 ranges from 1943 to 1948, plus some contain -1.
927 @code{decimal} is the decimal point character. The observed values
928 are @samp{.} and @samp{,}.
930 @code{grouping} is the grouping character. Usually, it is @samp{,} if
931 @code{decimal} is @samp{.}, and vice versa. Other observed values are
932 @samp{'} (apostrophe), @samp{ } (space), and zero (presumably
933 indicating that digits should not be grouped).
935 @code{dataset} is the name of the dataset analyzed to produce the
936 output, e.g.@: @code{DataSet1}, and @code{datafile} the name of the
937 file it was read from, e.g.@: @file{C:\Users\foo\bar.sav}. The latter
938 is sometimes the empty string.
940 @code{date} is a date, as seconds since the epoch, i.e.@: since
941 January 1, 1970. Pivot tables within an SPV files often have dates a
942 few minutes apart, so this is probably a creation date for the tables
943 rather than for the file.
945 Sometimes @code{dataset}, @code{datafile}, and @code{date} are present
946 and other times they are absent. The reader can distinguish by
947 assuming that they are present and then checking whether the
948 presumptive @code{dataset} contains a null byte (a valid string never
951 @code{n-ccs} is observed as either 0 or 5. When it is 5, the
952 following strings are CCA through CCE format strings. @xref{Custom
953 Currency Formats,,, pspp, PSPP}. Most commonly these are all
954 @code{-,,,} but other strings occur.
956 @node SPV Light Member Dimensions
957 @subsection Dimensions
959 A pivot table presents multidimensional data. A Dimension identifies
960 the categories associated with each dimension.
964 Dimensions @result{} int[@t{n-dims}] Dimension*[@t{n-dims}]
965 Dimension @result{} Value[@t{name}] DimUnknown int[@t{n-categories}] Category*[@t{n-categories}]
968 (00 @math{|} 01 @math{|} 02)[@t{d2}]
969 (i0 @math{|} i2)[@t{d3}]
970 (00 @math{|} 01)[@t{d4}]
971 (00 @math{|} 01)[@t{d5}]
977 @code{name} is the name of the dimension, e.g. @code{Variables},
978 @code{Statistics}, or a variable name.
980 @code{d1} is usually 0 but many other values have been observed.
982 @code{d3} is 2 over 99% of the time.
984 @code{d5} is 0 over 99% of the time.
986 @code{d6} is either -1 or the 0-based index of the dimension, e.g.@: 0
987 for the first dimension, 1 for the second, and so on. The latter is
988 the case 98% of the time in the corpus.
990 @node SPV Light Member Categories
991 @subsection Categories
993 Categories are arranged in a tree. Only the leaf nodes in the tree
994 are really categories; the others just serve as grouping constructs.
998 Category @result{} Value[@t{name}] (Leaf @math{|} Group)
999 Leaf @result{} 00 00 00 i2 int[@t{index}] i0
1001 (00 @math{|} 01)[@t{merge}] 00 01 (i0 @math{|} i2)[@t{data}]
1002 i-1 int[@t{n-subcategories}] Category*[@t{n-subcategories}]
1006 @code{name} is the name of the category (or group).
1008 A Leaf represents a leaf category. The Leaf's @code{index} is a
1009 nonnegative integer less than @code{n-categories} in the Dimension in
1010 which the Category is nested (directly or indirectly).
1012 A Group represents a Group of nested categories. Usually a Group
1013 contains at least one Category, so that @code{n-subcategories} is
1014 positive, but a few Groups with @code{n-subcategories} 0 has been
1017 If a Group's @code{merge} is 00, the most common value, then the group
1018 is really a distinct group that should be represented as such in the
1019 visual representation and user interface. If @code{merge} is 01, the
1020 categories in this group should be shown and treated as if they were
1021 direct children of the group's containing group (or if it has no
1022 parent group, then direct children of the dimension), and this group's
1023 name is irrelevant and should not be displayed. (Merged groups can be
1026 A Group's @code{data} appears to be i2 when all of the categories
1027 within a group are leaf categories that directly represent data values
1028 for a variable (e.g. in a frequency table or crosstabulation, a group
1029 of values in a variable being tabulated) and i0 otherwise.
1031 @node SPV Light Member Data
1034 The final part of an SPV light member contains the actual data.
1039 int[@t{layers}] int[@t{rows}] int[@t{columns}] int*[@t{n-dimensions}]
1040 int[@t{n-data}] Datum*[@t{n-data}]
1041 Datum @result{} int64[@t{index}] v3(00?) Value
1045 The values of @code{layers}, @code{rows}, and @code{columns} each
1046 specifies the number of dimensions displayed in layers, rows, and
1047 columns, respectively. Any of them may be zero. Their values sum to
1048 @code{n-dimensions} from Dimensions (@pxref{SPV Light Member
1051 The @code{n-dimensions} integers are a permutation of the 0-based
1052 dimension numbers. The first @code{layers} integers specify each of
1053 the dimensions represented by layers, the next @code{rows} integers
1054 specify the dimensions represented by rows, and the final
1055 @code{columns} integers specify the dimensions represented by columns.
1056 When there is more than one dimension of a given kind, the inner
1057 dimensions are given first.
1059 The format of a Datum varies slightly from version 1 to version 3: in
1060 version 1 it allows for an extra optional 00 byte.
1062 A Datum consists of an @code{index} and a Value. Suppose there are
1063 @math{d} dimensions and dimension @math{i}, @math{0 \le i < d}, has
1064 @math{n_i} categories. Consider the datum at coordinates @math{x_i},
1065 @math{0 \le i < d}, and note that @math{0 \le x_i < n_i}. Then the
1066 index is calculated by the following algorithm:
1070 for each @math{i} from 0 to @math{d - 1}:
1071 @i{index} = (@math{n_i \times} @i{index}) @math{+} @math{x_i}
1074 For example, suppose there are 3 dimensions with 3, 4, and 5
1075 categories, respectively. The datum at coordinates (1, 2, 3) has
1076 index @math{5 \times (4 \times (3 \times 0 + 1) + 2) + 3 = 33}.
1078 @node SPV Light Member Value
1081 Value is used throughout the SPV light member format. It boils down
1082 to a number or a string.
1086 Value @result{} 00? 00? 00? 00? RawValue
1088 01 ValueMod int[@t{format}] double[@t{x}]
1089 @math{|} 02 ValueMod int[@t{format}] double[@t{x}]
1090 string[@t{varname}] string[@t{vallab}] (01 @math{|} 02 @math{|} 03)
1091 @math{|} 03 string[@t{local}] ValueMod string[@t{id}] string[@t{c}] (00 @math{|} 01)[@t{type}]
1092 @math{|} 04 ValueMod int[@t{format}] string[@t{vallab}] string[@t{varname}]
1093 (01 @math{|} 02 @math{|} 03) string[@t{s}]
1094 @math{|} 05 ValueMod string[@t{varname}] string[@t{varlabel}] (01 @math{|} 02 @math{|} 03)
1095 @math{|} ValueMod string[@t{format}] int[@t{n-args}] Argument*[@t{n-args}]
1098 @math{|} int[@t{x}] i0 Value*[@t{x}@math{+}1] /* @t{x} @math{>} 0 */
1102 There are several possible encodings, which one can distinguish by the
1103 first nonzero byte in the encoding.
1107 The numeric value @code{x}, intended to be presented to the user
1108 formatted according to @code{format}, which is in the format described
1109 for system files. @xref{System File Output Formats}, for details.
1110 Most commonly, @code{format} has width 40 (the maximum).
1112 An @code{x} with the maximum negative double value @code{-DBL_MAX}
1113 represents the system-missing value SYSMIS. (HIGHEST and LOWEST have
1114 not been observed.) @xref{System File Format}, for more about these
1118 Similar to @code{01}, with the additional information that @code{x} is
1119 a value of variable @code{varname} and has value label @code{vallab}.
1120 Both @code{varname} and @code{vallab} can be the empty string, the
1121 latter very commonly.
1123 The meaning of the final byte is unknown. Possibly it is connected to
1124 whether the value or the label should be displayed.
1127 A text string, in two forms: @code{c} is in English, and sometimes
1128 abbreviated or obscure, and @code{local} is localized to the user's
1129 locale. In an English-language locale, the two strings are often the
1130 same, and in the cases where they differ, @code{local} is more
1131 appropriate for a user interface, e.g.@: @code{c} of ``Not a PxP table
1132 for MCN...'' versus @code{local} of ``Computed only for a PxP table,
1133 where P must be greater than 1.''
1135 @code{c} and @code{local} are always either both empty or both
1138 @code{id} is a brief identifying string whose form seems to resemble a
1139 programming language identifier, e.g.@: @code{cumulative_percent} or
1140 @code{factor_14}. It is not unique.
1142 @code{type} is 00 for text taken from user input, such as syntax
1143 fragment, expressions, file names, data set names, and 01 for fixed
1144 text strings such as names of procedures or statistics. In the former
1145 case, @code{id} is always the empty string; in the latter case,
1146 @code{id} is still sometimes empty.
1149 The string value @code{s}, intended to be presented to the user
1150 formatted according to @code{format}. The format for a string is not
1151 too interesting, and the corpus contains many clearly invalid formats
1152 like A16.39 or A255.127 or A134.1, so readers should probably ignore
1153 the format entirely.
1155 @code{s} is a value of variable @code{varname} and has value label
1156 @code{vallab}. @code{varname} is never empty but @code{vallab} is
1159 The meaning of the final byte is unknown.
1162 Variable @code{varname}, which is rarely observed as empty in the
1163 corpus, with variable label @code{varlabel}, which is often empty.
1165 The meaning of the final byte is unknown.
1168 (These bytes begin a ValueMod.) A format string, analogous to
1169 @code{printf}, followed by one or more Arguments, each of which has
1170 one or more values. The format string uses the following syntax:
1177 Each of these expands to the character following @samp{\\}, to escape
1178 characters that have special meaning in format strings. These are
1179 effective inside and outside the @code{[@dots{}]} syntax forms
1183 Expands to a new-line, inside or outside the @code{[@dots{}]} forms
1187 Expands to a formatted version of argument @var{i}, which must have
1188 only a single value. For example, @code{^1} expands to the first
1189 argument's @code{value}.
1191 @item [:@var{a}:]@var{i}
1192 Expands @var{a} for each of the values in @var{i}. @var{a}
1193 should contain one or more @code{^@var{j}} conversions, which are
1194 drawn from the values for argument @var{i} in order. Some examples
1199 All of the values for the first argument, concatenated.
1202 Expands to the values for the first argument, each followed by
1206 Expands to @code{@var{x} = @var{y}} where @var{x} is the second
1207 argument's first value and @var{y} is its second value. (This would
1208 be used only if the argument has two values. If there were more
1209 values, the second and third values would be directly concatenated,
1210 which would look funny.)
1213 @item [@var{a}:@var{b}:]@var{i}
1214 This extends the previous form so that the first values are expanded
1215 using @var{a} and later values are expanded using @var{b}. For an
1216 unknown reason, within @var{a} the @code{^@var{j}} conversions are
1217 instead written as @code{%@var{j}}. Some examples from the corpus:
1221 Expands to all of the values for the first argument, separated by
1224 @item [%1 = %2:, ^1 = ^2:]1
1225 Given appropriate values for the first argument, expands to @code{X =
1229 Given appropriate values, expands to @code{1, 2, 3}.
1233 The format string is localized to the user's locale.
1236 @node SPV Light Member ValueMod
1237 @subsection ValueMod
1239 A ValueMod can specify special modifications to a Value.
1244 31 i0 (i0 @math{|} i1 string[@t{subscript}])
1245 v1(00 (i1 @math{|} i2) 00 00 int 00 00)
1246 v3(count(FormatString Style ValueModUnknown))
1247 @math{|} 31 int[@t{n-refs}] int16*[@t{n-refs}] Format
1249 Style @result{} 58 @math{|} 31 01? 00? 00? 00? 01 string[@t{fgcolor}] string[@t{bgcolor}] string[@t{typeface}] byte
1250 Format @result{} 00 00 count(FormatString Style 58)
1251 FormatString @result{} count((i0 (58 @math{|} 31 string))?)
1252 ValueModUnknown @result{} 58 @math{|} 31 i0 i0 i0 i0 01 00 (01 @math{|} 02 @math{|} 08) 00 08 00 0a 00)
1256 A ValueMod that begins with ``31 i0'' specifies a string to append to
1257 the main text of the Value, as a subscript. The subscript text is a
1258 brief indicator, e.g.@: @samp{a} or @samp{a,b}, with its meaning
1259 indicated by the table caption. In this usage, subscripts are similar
1260 to footnotes. One apparent difference is that a Value can only
1261 reference one footnote but a subscript can list more than one letter.
1263 A ValueMod that begins with 31 followed by a nonzero ``int'' specifies
1264 a footnote or footnotes that the Value references. Footnote markers
1265 are shown appended to the main text of the Value, as superscripts.
1267 The Format, if present, is a format string for substitutions using the
1268 syntax explained previously. It appears to be an English-language
1269 version of the localized format string in the Value in which the
1272 The Style, if present, changes the style for this individual Value.
1274 @node SPV Legacy Detail Member Binary Format
1275 @section Legacy Detail Member Binary Format
1277 Whereas the light binary format represents everything about a given
1278 pivot table, the legacy binary format conceptually consists of a
1279 number of named sources, each of which consists of a number of named
1280 variables, each of which is a 1-dimensional array of numbers or
1281 strings or a mix. Thus, the legacy binary member format is quite
1284 This section uses the same context-free grammar notation as in the
1285 previous section, with the following additions:
1289 In a version 0xaf legacy member, @var{x}; in other versions, nothing.
1290 (The legacy member header indicates the version; see below.)
1293 In a version 0xb0 legacy member, @var{x}; in other versions, nothing.
1296 A legacy detail member @file{.bin} has the following overall format:
1300 LegacyBinary @result{}
1301 00 byte[@t{version}] int16[@t{n-sources}] int[@t{member-size}]
1302 Metadata*[@t{n-sources}] Data*[@t{n-sources}]
1306 @code{version} is a version number that affects the interpretation of
1307 some of the other data in the member. Versions 0xaf and 0xb0 are
1308 known. We will refer to ``version 0xaf'' and ``version 0xb0'' members
1311 A legacy member consists of @code{n-sources} data sources, each of
1312 which has Metadata and Data.
1314 @code{member-size} is the size of the legacy binary member, in bytes.
1316 The following sections go into more detail.
1319 * SPV Legacy Member Metadata::
1320 * SPV Legacy Member Data::
1323 @node SPV Legacy Member Metadata
1324 @subsection Metadata
1329 int[@t{n-data}] int[@t{n-variables}] int[@t{offset}]
1330 vAF(byte*32[@t{source-name}])
1331 vB0(byte*64[@t{source-name}] int[@t{x}])
1335 A data source has @code{n-variables} variables, each with
1336 @code{n-data} data values.
1338 @code{source-name} is a 32- or 64-byte string padded on the right with
1339 zero bytes. The names that appear in the corpus are very generic:
1340 usually @code{tableData} for pivot table data or @code{source0} for
1343 A given Metadata's @code{offset} is the offset, in bytes, from the
1344 beginning of the member to the start of the corresponding Data. This
1345 allows programs to skip to the beginning of the data for a particular
1346 source; it is also important to determine whether a source includes
1347 any string data (@pxref{SPV Legacy Member Data}).
1349 The meaning of @code{x} in version 0xb0 is unknown.
1351 @node SPV Legacy Member Data
1356 Data @result{} NumericData*[@t{n-variables}] StringData?
1357 NumericData @result{} byte*288[@t{variable-name}] double*[@t{n-data}]
1361 Data follow the Metadata in the legacy binary format, with sources in
1362 the same order. Each NumericSeries begins with a @code{variable-name}
1363 that generally indicates its role in the pivot table, e.g.@: ``cell'',
1364 ``cellFormat'', ``dimension0categories'', ``dimension0group0'',
1365 followed by the numeric data, one double per datum. A double with the
1366 maximum negative double @code{-DBL_MAX} represents the system-missing
1371 StringData @result{} i1 string[@t{source-name}] Pairs Labels
1373 Pairs @result{} int[@t{n-string-vars}] PairSeries*[@t{n-string-vars}]
1374 PairVar @result{} string[@t{pair-var-name}] int[@t{n-pairs}] Pair*[@t{n-pairs}]
1375 Pair @result{} int[@t{i}] int[@t{j}]
1377 Labels @result{} int[@t{n-labels}] Label*[@t{n-labels}]
1378 Label @result{} int[@t{frequency}] int[@t{s}]
1382 A source may include a mix of numeric and string data values. When a
1383 source includes any string data, the data values that are strings are
1384 set to SYSMIS in the NumericData, and StringData follows the
1385 NumericData. A source that contains no string data omits the
1386 StringData. To reliably determine whether a source includes
1387 StringData, the reader should check whether the offset following the
1388 NumericData is the offset of the next source, as indicated by its
1389 Metadata (or the end of the member, in the case of the last source).
1391 StringData repeats the name of the source (from Metadata).
1393 The string data overlays the numeric data. @code{n-string-vars} is
1394 the number of variables in the source that include string data. More
1395 precisely, it is the 1-based index of the last variable in the source
1396 that includes any string data; thus, it would be 4 if there are 5
1397 variables and only the fourth one includes string data.
1399 Each PairVar consists a sequence of 0 or more Pair nonterminals, each
1400 of which maps from a 0-based index within variable @code{i} to a
1401 0-based label index @code{j}, e.g.@: pair @code{i} = 2, @code{j} = 3,
1402 means that the third data value (with value SYSMIS) is to be replaced
1403 by the string of the fourth Label.
1405 The labels themselves follow the pairs. The valuable part of each
1406 label is the string @code{s}. Each label also includes a
1407 @code{frequency} that reports the number of pairs that reference it
1408 (although this is not useful).
1410 @node SPV Legacy Detail Member XML Format
1411 @section Legacy Detail Member XML Format
1413 This format is still under investigation.
1415 The design of the detail XML format is not what one would end up with
1416 for describing pivot tables. This is because it is a special case
1417 of a much more general format (``visualization XML'' or ``VizML'')
1418 that can describe a wide range of visualizations. Most of this
1419 generality is overkill for tables, and so we end up with a funny
1420 subset of a general-purpose format.
1422 The important elements of the detail XML format are:
1426 Variables. Variables in detail XML roughly correspond to the
1427 dimensions in a light detail member. There is one variable for each
1428 dimension, plus one variable for each level of labeling along an axis.
1430 The bulk of variables are defined with @code{sourceVariable} elements.
1431 The data for these variables comes from the associated
1432 @code{tableData.bin} member. Some variables are defined, with
1433 @code{derivedVariable} elements, as a constant or in terms of a
1434 mapping function from a source variable.
1437 Assignment of variables to axes. A variable can appear as columns, or
1438 rows, or layers. The @code{faceting} element and its sub-elements
1439 describe this assignment.
1442 All elements have an optional @code{id} attribute. In practice many
1443 elements are assigned @code{id} attributes that are never referenced.
1446 * SPV Detail visualization Element::
1447 * SPV Detail userSource Element::
1448 * SPV Detail sourceVariable Element::
1449 * SPV Detail derivedVariable Element::
1450 * SPV Detail extension Element::
1451 * SPV Detail graph Element::
1452 * SPV Detail location Element::
1453 * SPV Detail coordinates Element::
1454 * SPV Detail faceting Element::
1455 * SPV Detail facetLayout Element::
1458 @node SPV Detail visualization Element
1459 @subsection The @code{visualization} Element
1462 Parent: Document root
1466 (sourceVariable @math{|} derivedVariable)@math{+}
1474 This element has the following attributes.
1476 @defvr {Required} creator
1477 The version of the software that created this SPV file, as a string of
1478 the form @code{xxyyzz}, which represents software version xx.yy.zz,
1479 e.g.@: @code{160001} is version 16.0.1. The corpus includes major
1480 versions 16 through 19.
1483 @defvr {Required} date
1484 The date on the which the file was created, as a string of the form
1488 @defvr {Required} lang
1489 The locale used for output, in Windows format, which is similar to the
1490 format used in Unix with the underscore replaced by a hyphen, e.g.@:
1491 @code{en-US}, @code{en-GB}, @code{el-GR}, @code{sr-Cryl-RS}.
1494 @defvr {Required} name
1495 The title of the pivot table, localized to the output language.
1498 @defvr {Required} style
1499 The @code{id} of a @code{style} element (@pxref{SPV Detail style
1500 element}). This is the base style for the entire pivot table. In
1501 every example in the corpus, the value is @code{visualizationStyle}
1502 and the corresponding @code{style} element has no attributes other
1506 @defvr {Required} type
1507 A floating-point number. The meaning is unknown.
1510 @defvr {Required} version
1511 The visualization schema version number. In the corpus, the value is
1512 one of 2.4, 2.5, 2.7, and 2.8.
1515 @node SPV Detail userSource Element
1516 @subsection The @code{userSource} Element
1518 Parent: @code{visualization} @*
1521 This element has the following attributes.
1523 @defvr {Optional} missing
1524 Always @code{listwise}.
1527 @node SPV Detail sourceVariable Element
1528 @subsection The @code{sourceVariable} Element
1530 Parent: @code{visualization} @*
1531 Contents: @code{extension}* (@code{format} @math{|} @code{stringFormat})?
1533 This element defines a variable whose values can be used elsewhere in
1534 the visualization. It ties this element's @code{id} to a variable
1535 from the @file{tableData.bin} member that corresponds to this
1538 This element has the following attributes.
1540 @defvr {Required} categorical
1541 Always set to @code{true}.
1544 @defvr {Required} source
1545 Always set to @code{tableData}, the @code{source-name} in the
1546 corresponding @file{tableData.bin} member (@pxref{SPV Legacy Member
1550 @defvr {Required} sourceName
1551 The name of a variable within the source, the @code{variable-name} in
1552 the corresponding @file{tableData.bin} member (@pxref{SPV Legacy
1556 @defvr {Optional} dependsOn
1557 The @code{variable-name} of a variable linked to this one, so that a
1558 viewer can work with them together. For a group variable, this is the
1559 name of the corresponding categorical variable.
1562 @defvr {Optional} label
1563 The variable label, if any
1566 @defvr {Optional} labelVariable
1567 The @code{variable-name} of a variable whose string values correspond
1568 one-to-one with the values of this variable and are suitable for use
1572 @node SPV Detail derivedVariable Element
1573 @subsection The @code{derivedVariable} Element
1575 Parent: @code{visualization} @*
1576 Contents: @code{extension}* (@code{format} @math{|} @code{stringFormat} @code{valueMapEntry}*)
1578 Like @code{sourceVariable}, this element defines a variable whose
1579 values can be used elsewhere in the visualization. Instead of being
1580 read from a data source, the variable's data are defined by a
1581 mathematical expression.
1583 This element has the following attributes.
1585 @defvr {Required} categorical
1586 Always set to @code{true}.
1589 @defvr {Required} value
1590 An expression that defines the variable's value. In theory this could
1591 be an arbitrary expression in terms of constants, functions, and other
1592 variables, e.g.@: @math{(@var{var1} + @var{var2}) / 2}. In practice,
1593 the corpus contains only the following forms of expressions:
1596 @item constant(@var{number})
1597 @itemx constant(@var{variable})
1598 A constant. The meaning when a variable is named is unknown.
1599 Sometimes the ``variable name'' has spaces in it.
1601 @item map(@var{variable})
1602 Transforms the values in the named @var{variable} using the
1603 @code{valueMapEntry}s contained within the element.
1607 @defvr {Optional} dependsOn
1608 The @code{variable-name} of a variable linked to this one, so that a
1609 viewer can work with them together. For a group variable, this is the
1610 name of the corresponding categorical variable.
1614 * SPV Detail valueMapEntry Element::
1617 @node SPV Detail valueMapEntry Element
1618 @subsubsection The @code{valueMapEntry} Element
1620 Parent: @code{derivedVariable} @*
1623 A @code{valueMapEntry} element defines a mapping from one or more
1624 values of a source expression to a target value. (In the corpus, the
1625 source expression is always just the name of a variable.) Each target
1626 value requires a separate @code{valueMapEntry}. If multiple source
1627 values map to the same target value, they can be combined or separate.
1629 @code{valueMapEntry} has the following attributes.
1631 @defvr {Required} from
1632 A source value, or multiple source values separated by semicolons,
1633 e.g.@: @code{0} or @code{13;14;15;16}.
1636 @defvr {Required} to
1640 @node SPV Detail extension Element
1641 @subsection The @code{extension} Element
1643 This is a general-purpose ``extension'' element. Readers that don't
1644 understand a given extension should be able to safely ignore it. The
1645 attributes on this element, and their meanings, vary based on the
1646 context. Each known usage is described separately below. The current
1647 extensions use attributes exclusively, without any nested elements.
1649 @subsubheading @code{visualization} Parent Element
1651 With @code{visualization} as its parent element, @code{extension} has
1652 the following attributes.
1654 @defvr {Optional} numRows
1655 An integer that presumably defines the number of rows in the displayed
1659 @defvr {Optional} showGridline
1660 Always set to @code{false} in the corpus.
1663 @defvr {Optional} minWidthSet
1664 @defvrx {Optional} maxWidthSet
1665 Always set to @code{true} in the corpus.
1668 @subsubheading @code{container} Parent Element
1670 With @code{container} as its parent element, @code{extension} has the
1671 following attributes.
1673 @defvr {Required} combinedFootnotes
1674 Always set to @code{true} in the corpus.
1677 @subsubheading @code{sourceVariable} and @code{derivedVariable} Parent Element
1679 With @code{sourceVariable} or @code{derivedVariable} as its parent
1680 element, @code{extension} has the following attributes. A given
1681 parent element often contains several @code{extension} elements that
1682 specify the meaning of the source data's variables or sources, e.g.@:
1685 <extension from="0" helpId="corrected_model"/>
1686 <extension from="3" helpId="error"/>
1687 <extension from="4" helpId="total_9"/>
1688 <extension from="5" helpId="corrected_total"/>
1691 @defvr {Required} from
1692 An integer or a name like ``dimension0''.
1695 @defvr {Required} helpId
1699 @node SPV Detail graph Element
1700 @subsection The @code{graph} Element
1702 Parent: @code{visualization} @*
1703 Contents: @code{location}@math{+} @code{coordinates} @code{faceting} @code{facetLayout} @code{interval}
1705 @code{graph} has the following attributes.
1707 @defvr {Required} cellStyle
1708 @defvrx {Required} style
1709 Each of these is the @code{id} of a @code{style} element (@pxref{SPV
1710 Detail style element}). The former is the default style for
1711 individual cells, the latter for the entire table.
1714 @node SPV Detail location Element
1715 @subsection The @code{location} Element
1717 Parent: @code{graph} @*
1720 Each instance of this element specifies where some part of the table
1721 frame is located. All the examples in the corpus have four instances
1722 of this element, one for each of the parts @code{height},
1723 @code{width}, @code{left}, and @code{top}. Some examples in the
1724 corpus add a fifth for part @code{bottom}, even though it is not clear
1725 how all of @code{top}, @code{bottom}, and @code{heigth} can be honored
1726 at the same time. In any case, @code{location} seems to have little
1727 importance in representing tables; a reader can safely ignore it.
1729 @defvr {Required} part
1730 One of @code{height}, @code{width}, @code{top}, @code{bottom}, or
1731 @code{left}. Presumably @code{right} is acceptable as well but the
1732 corpus contains no examples.
1735 @defvr {Required} method
1736 How the location is determined:
1740 Based on the natural size of the table. Observed only for
1741 parts @code{height} and @code{width}.
1744 Based on the location specified in @code{target}. Observed only for
1745 parts @code{top} and @code{bottom}.
1748 Using the value in @code{value}. Observed only for parts @code{top},
1749 @code{bottom}, and @code{left}.
1752 Same as the specified @code{target}. Observed only for part
1757 @defvr {Optional} min
1758 Minimum size. Only observed with value @code{100pt}. Only observed
1759 for part @code{width}.
1762 @defvr {Dependent} target
1763 Required when @code{method} is @code{attach} or @code{same}, not
1764 observed otherwise. This is the ID of an element to attach to.
1765 Observed with the ID of @code{title}, @code{footnote}, @code{graph},
1769 @defvr {Dependent} value
1770 Required when @code{method} is @code{fixed}, not observed otherwise.
1771 Observed values are @code{0%}, @code{0px}, @code{1px}, and @code{3px}
1772 on parts @code{top} and @code{left}, and @code{100%} on part
1776 @node SPV Detail coordinates Element
1777 @subsection The @code{coordinates} Element
1779 Parent: @code{graph} @*
1782 This element is always present and always empty, with no attributes
1785 @node SPV Detail faceting Element
1786 @subsection The @code{faceting} Element
1788 Parent: @code{graph} @*
1789 Contents: @code{cross} @code{layer}*
1791 The @code{faceting} element describes the row, column, and layer
1792 structure of the table. Its @code{cross} child determines the row and
1793 column structure, and each @code{layer} child (if any) represents a
1796 @code{faceting} has no attributes (other than @code{id}).
1798 @subsubheading The @code{cross} Element
1800 Parent: @code{faceting} @*
1801 Contents: @code{nest} @code{nest}
1803 The @code{cross} element describes the row and column structure of the
1804 table. It has exactly two @code{nest} children, the first of which
1805 describes the table's rows and the second the table's columns.
1807 @code{cross} has no attributes (other than @code{id}).
1809 @subsubheading The @code{nest} Element
1811 Parent: @code{cross} @*
1812 Contents: @code{variableReference}@math{+}
1814 A given @code{nest} usually consists of one or more dimensions, each
1815 of which is represented by @code{variableReference} child elements.
1816 Minimally, a dimension has two @code{variableReference} children, one
1817 for the categories, one for the data, e.g.:
1821 <variableReference ref="dimension0categories"/>
1822 <variableReference ref="dimension0"/>
1827 Groups of categories introduce additional variable references, e.g.@:
1831 <variableReference ref="dimension0categories"/>
1832 <variableReference ref="dimension0group0"/>
1833 <variableReference ref="dimension0"/>
1838 Grouping can be hierarchical, e.g.@:
1842 <variableReference ref="dimension0categories"/>
1843 <variableReference ref="dimension0group1"/>
1844 <variableReference ref="dimension0group0"/>
1845 <variableReference ref="dimension0"/>
1850 XXX what are group maps?
1853 <nest id="nest_1973">
1854 <variableReference ref="dimension1categories"/>
1855 <variableReference ref="dimension1group1map"/>
1856 <variableReference ref="dimension1group0map"/>
1857 <variableReference ref="dimension1"/>
1860 <variableReference ref="dimension0categories"/>
1861 <variableReference ref="dimension0group0map"/>
1862 <variableReference ref="dimension0"/>
1867 A @code{nest} can contain multiple dimensions:
1871 <variableReference ref="dimension1categories"/>
1872 <variableReference ref="dimension1group0"/>
1873 <variableReference ref="dimension1"/>
1874 <variableReference ref="dimension0categories"/>
1875 <variableReference ref="dimension0"/>
1879 One @code{nest} within a given @code{cross} may have no dimensions, in
1880 which case it still has one @code{variableReference} child, which
1881 references a @code{derivedVariable} whose @code{value} attribute is
1882 @code{constant(0)}. In the corpus, such a @code{derivedVariable} has
1883 @code{row} or @code{column}, respectively, as its @code{id}.
1885 @code{nest} has no attributes (other than @code{id}).
1887 @subsubheading The @code{variableReference} Element
1889 Parent: @code{nest} @*
1892 @code{variableReference} has one attribute.
1894 @defvr {Required} ref
1895 The @code{id} of a @code{sourceVariable} or @code{derivedVariable}
1899 @subsubheading The @code{layer} Element
1901 Parent: @code{faceting} @*
1904 Each layer is represented by a pair of @code{layer} elements. The
1905 first of this pair is for a category variable, the second for the data
1909 <layer value="0" variable="dimension0categories" visible="true"/>
1910 <layer value="dimension0" variable="dimension0" visible="false"/>
1914 @code{layer} has the following attributes.
1916 @defvr {Required} variable
1917 The @code{id} of a @code{sourceVariable} or @code{derivedVariable}
1921 @defvr {Required} value
1922 The value to select. For a category variable, this is always
1923 @code{0}; for a data variable, it is the same as the @code{variable}
1927 @defvr {Optional} visible
1928 Whether the layer is visible. Generally, category layers are visible
1929 and data layers are not, but sometimes this attribute is omitted.
1932 @defvr {Optional} method
1933 When present, this is always @code{nest}.
1936 @node SPV Detail facetLayout Element
1937 @subsection The @code{facetLayout} Element
1939 Parent: @code{graph} @*
1940 Contents: @code{tableLayout} @code{facetLevel}@math{+} @code{setCellProperties}*
1942 @subsubheading The @code{tableLayout} Element
1944 Parent: @code{facetLayout} @*
1947 @defvr {Required} verticalTitlesInCorner
1948 Always set to @code{true}.
1951 @defvr {Optional} style
1952 The @code{id} of a @code{style} element.
1955 @defvr {Optional} fitCells
1956 Always set to @code{ticks}.
1959 @subsubheading The @code{facetLevel} Element
1961 Parent: @code{facetLayout} @*
1962 Contents: @code{axis}
1964 Each @code{facetLevel} describes a @code{variableReference} or
1965 @code{layer}, and a table has one @code{facetLevel} element for
1966 each such element. For example, an SPV detail member that contains
1967 four @code{variableReference} elements and two @code{layer} elements
1968 will contain six @code{facetLevel} elements.
1970 In the corpus, @code{facetLevel} elements and the elements that they
1971 describe are always in the same order. The correspondence may also be
1972 observed in two other ways. First, one may use the @code{level}
1973 attribute, described below. Second, in the corpus, a
1974 @code{facetLevel} always has an @code{id} that is the same as the
1975 @code{id} of the element it describes with @code{_facetLevel}
1976 appended. One should not formally rely on this, of course, but it is
1977 usefully indicative.
1979 @defvr {Required} level
1980 A 1-based index into the @code{variableReference} and @code{layer}
1981 elements, e.g.@: a @code{facetLayout} with a @code{level} of 1
1982 describes the first @code{variableReference} in the SPV detail member,
1983 and in a member with four @code{variableReference} elements, a
1984 @code{facetLayout} with a @code{level} of 5 describes the first
1985 @code{layer} in the member.
1988 @defvr {Required} gap
1989 Always observed as @code{0pt}.
1992 @subsubheading The @code{axis} Element
1994 Parent: @code{facetLevel} @*
1995 Contents: @code{label}? @code{majorTicks}
1997 @defvr {Attribute} style
1998 The @code{id} of a @code{style} element.
2001 @subsubheading The @code{label} Element
2003 Parent: @code{axis} or @code{labelFrame} @*
2004 Contents: @code{text}@math{+} @math{|} @code{descriptionGroup}
2006 This element represents a label on some aspect of the table. For example,
2007 the table's title is a @code{label}.
2009 The contents of the label can be one or more @code{text} elements or a
2010 @code{descriptionGroup}.
2012 @defvr {Attribute} style
2013 @defvrx {Optional} textFrameStyle
2014 Each of these is the @code{id} of a @code{style} element.
2015 @code{style} is the style of the label text, @code{textFrameStyle} the
2016 style for the frame around the label.
2019 @defvr {Optional} purpose
2020 The kind of entity being labeled, one of @code{title},
2021 @code{subTitle}, @code{layer}, or @code{footnote}.
2024 @subsubheading The @code{descriptionGroup} Element
2026 Parent: @code{label} @*
2027 Contents: (@code{description} @math{|} @code{text})@math{+}
2029 A @code{descriptionGroup} concatenates one or more elements to form a
2030 label. Each element can be a @code{text} element, which contains
2031 literal text, or a @code{description} element that substitutes a value
2034 @defvr {Attribute} target
2035 The @code{id} of an element being described. In the corpus, this is
2036 always @code{faceting}.
2039 @defvr {Attribute} separator
2040 A string to separate the description of multiple groups, if the
2041 @code{target} has more than one. In the corpus, this is always a
2045 Typical contents for a @code{descriptionGroup} are a value by itself:
2047 <description name="value"/>
2049 @noindent or a variable and its value, separated by a colon:
2051 <description name="variable"/><text>:</text><description name="value"/>
2054 @subsubheading The @code{description} Element
2056 Parent: @code{descriptionGroup} @*
2059 A @code{description} is like a macro that expands to some property of
2060 the target of its parent @code{descriptionGroup}.
2062 @defvr {Attribute} name
2063 The name of the property. Only @code{variable} and @code{value}
2064 appear in the corpus.
2067 @subsubheading The @code{majorTicks} Element
2069 Parent: @code{axis} @*
2070 Contents: @code{gridline}?
2072 @defvr {Attribute} labelAngle
2073 @defvrx {Attribute} length
2074 Both always defined to @code{0}.
2077 @defvr {Attribute} style
2078 @defvrx {Attribute} tickFrameStyle
2079 Each of these is the @code{id} of a @code{style} element.
2080 @code{style} is the style of the tick labels, @code{tickFrameStyle}
2081 the style for the frames around the labels.
2084 @subsubheading The @code{gridline} Element
2086 Parent: @code{majorTicks} @*
2089 Represents ``gridlines,'' which for a table represents the lines
2090 between the rows or columns of a table (XXX?).
2092 @defvr {Attribute} style
2093 The style for the gridline.
2096 @defvr {Attribute} zOrder
2097 Observed as a number between 28 and 31. Does not seem to be
2101 @subsubheading The @code{setCellProperties} Element
2103 Parent: @code{facetLayout} @*
2104 Contents: @code{setMetaData} @code{setStyle}* @code{setFormat}@math{+} @code{union}?
2106 This element sets style properties of cells designated by the
2107 @code{target} attribute of its child elements, as further restricted
2108 by the optional @code{union} element if present. The @code{target}
2109 values often used, e.g.@: @code{graph} or @code{labeling}, actually
2110 affect every cell, so the @code{union} element is a useful
2113 @defvr {Optional} applyToConverse
2114 If present, always @code{true}. This appears to invert the meaning of
2115 the @code{target} of sub-elements: the selected cells are the ones
2116 @emph{not} designated by @code{target}. This is confusing, given the
2117 additional restrictions of @code{union}, but in the corpus
2118 @code{applyToConverse} is never present along with @code{union}.
2121 @subsubheading The @code{setMetaData} Element
2123 Parent: @code{setCellProperties} @*
2126 This element is not known to have any visible effect.
2128 @defvr {Required} target
2129 The @code{id} of an element whose metadata is to be set. In the
2130 corpus, this is always @code{graph}, the @code{id} used for the
2131 @code{graph} element.
2134 @defvr {Required} key
2135 @defvrx {Required} value
2136 A key-value pair to set for the target.
2138 In the corpus, @code{key} is @code{cellPropId} or, rarely,
2139 @code{diagProps}, and @code{value} is always the @code{id} of the
2140 parent @code{setCellProperties}.
2143 @subsubheading The @code{setStyle} Element
2145 Parent: @code{setCellProperties} @*
2148 This element associates a style with the target.
2150 @defvr {Required} target
2151 The @code{id} of an element whose style is to be set. In the corpus,
2152 this is always the @code{id} of an @code{interval}, @code{labeling},
2153 or, rarely, @code{graph} element.
2156 @defvr {Required} style
2157 The @code{id} of a @code{style} element that identifies the style to
2161 @subsubheading The @code{setFormat} Element
2164 Parent: @code{setCellProperties}
2167 @math{|} @code{numberFormat}
2168 @math{|} @code{stringFormat}@math{+}
2169 @math{|} @code{dateTimeFormat}
2172 This element sets the format of the target, ``format'' in this case
2173 meaning the SPSS print format for a variable.
2175 The details of this element vary depending on the schema version, as
2176 declared in the root @code{visualization} element's @code{version}
2177 attribute (@pxref{SPV Detail visualization Element}). In version 2.5
2178 and earlier, @code{setFormat} contains one of a number of child
2179 elements that correspond to the different varieties of print formats.
2180 In version 2.7 and later, @code{setFormat} instead always contains a
2181 @code{format} element.
2183 XXX reinvestigate the above claim about versions: it appears to be
2186 The @code{setFormat} element itself has the following attributes.
2188 @defvr {Required} target
2189 The @code{id} of an element whose style is to be set. In the corpus,
2190 this is always the @code{id} of an @code{majorTicks} or
2191 @code{labeling} element.
2194 @defvr {Optional} reset
2195 If this is @code{true}, this format overrides the target's previous
2196 format. If it is @code{false}, the adds to the previous format. In
2197 the corpus this is always @code{true}. The default behavior is
2202 * SPV Detail format Element::
2203 * SPV Detail numberFormat Element::
2204 * SPV Detail stringFormat Element::
2205 * SPV Detail dateTimeFormat Element::
2206 * SPV Detail affix Element::
2207 * SPV Detail relabel Element::
2208 * SPV Detail union Element::
2211 @node SPV Detail format Element
2212 @subsubsection The @code{format} Element
2214 Parent: @code{sourceVariable}, @code{derivedVariable}, @code{formatMapping}, @code{labeling}, @code{formatMapping}, @code{setFormat} @*
2215 Contents: (@code{affix}@math{+} @math{|} @code{relabel}@math{+})?
2217 This element appears only in schema version 2.7 (@pxref{SPV Detail
2218 visualization Element}).
2220 This element determines a format, equivalent to an SPSS print format.
2222 @subsubheading Attributes for All Formats
2224 These attributes apply to all kinds of formats. The most important of
2225 these attributes determines the high-level kind of formatting in use:
2227 @defvr {Optional} baseFormat
2228 Either @code{dateTime} or @code{elapsedTime}. When this attribute is
2229 omitted, this element is a numeric or string format.
2233 Whether, in the corpus, other attributes are always present (``yes''),
2234 never present (``no''), or sometimes present (``opt'') depends on
2237 @multitable {maximumFractionDigits} {@code{dateTime}} {@code{elapsedTime}} {number} {string}
2238 @headitem Attribute @tab @code{dateTime} @tab @code{elapsedTime} @tab number @tab string
2239 @item errorCharacter @tab yes @tab yes @tab yes @tab opt
2241 @item separatorChars @tab yes @tab no @tab no @tab no
2243 @item mdyOrder @tab yes @tab no @tab no @tab no
2245 @item showYear @tab yes @tab no @tab no @tab no
2246 @item yearAbbreviation @tab yes @tab no @tab no @tab no
2248 @item showMonth @tab yes @tab no @tab no @tab no
2249 @item monthFormat @tab yes @tab no @tab no @tab no
2251 @item showDay @tab yes @tab opt @tab no @tab no
2252 @item dayPadding @tab yes @tab opt @tab no @tab no
2253 @item dayOfMonthPadding @tab yes @tab no @tab no @tab no
2254 @item dayType @tab yes @tab no @tab no @tab no
2256 @item showHour @tab yes @tab opt @tab no @tab no
2257 @item hourFormat @tab yes @tab opt @tab no @tab no
2258 @item hourPadding @tab yes @tab yes @tab no @tab no
2260 @item showMinute @tab yes @tab yes @tab no @tab no
2261 @item minutePadding @tab yes @tab yes @tab no @tab no
2263 @item showSecond @tab yes @tab yes @tab no @tab no
2264 @item secondPadding @tab no @tab yes @tab no @tab no
2266 @item showMillis @tab no @tab yes @tab no @tab no
2268 @item minimumIntegerDigits @tab no @tab no @tab yes @tab no
2269 @item maximumFractionDigits @tab no @tab yes @tab yes @tab no
2270 @item minimumFractionDigits @tab no @tab yes @tab yes @tab no
2271 @item useGrouping @tab no @tab opt @tab yes @tab no
2272 @item scientific @tab no @tab no @tab yes @tab no
2273 @item small @tab no @tab no @tab opt @tab no
2274 @item suffix @tab no @tab no @tab opt @tab no
2276 @item tryStringsAsNumbers @tab no @tab no @tab no @tab yes
2280 @defvr {Attribute} errorCharacter
2281 A character that replaces the formatted value when it cannot otherwise
2282 be represented in the given format. Always @samp{*}.
2285 @subsubheading Date and Time Attributes
2287 These attributes are used with @code{dateTime} and @code{elapsedTime}
2290 @defvr {Attribute} separatorChars
2291 Exactly four characters. In order, these are used for: decimal point,
2292 grouping, date separator, time separator. Always @samp{.,-:}.
2295 @defvr {Attribute} mdyOrder
2296 Within a date, the order of the days, months, and years.
2297 @code{dayMonthYear} is the only observed value, but one would expect
2298 that @code{monthDayYear} and @code{yearMonthDay} to be reasonable as
2302 @defvr {Attribute} showYear
2303 @defvrx {Attribute} yearAbbreviation
2304 Whether to include the year and, if so, whether the year should be
2305 shown abbreviated, that is, with only 2 digits. Each is @code{true}
2306 or @code{false}; only values of @code{true} and @code{false},
2307 respectively, have been observed.
2310 @defvr {Attribute} showMonth
2311 @defvrx {Attribute} monthFormat
2312 Whether to include the month (@code{true} or @code{false}) and, if so,
2313 how to format it. @code{monthFormat} is one of the following:
2317 The full name of the month, e.g.@: in an English locale,
2321 The abbreviated name of the month, e.g.@: in an English locale,
2325 The number representing the month, e.g.@: 9 for September.
2328 A two-digit number representing the month, e.g.@: 09 for September.
2331 Only values of @code{true} and @code{short}, respectively, have been
2335 @defvr {Attribute} dayPadding
2336 @defvrx {Attribute} dayOfMonthPadding
2337 @defvrx {Attribute} hourPadding
2338 @defvrx {Attribute} minutePadding
2339 @defvrx {Attribute} secondPadding
2340 These attributes presumably control whether each field in the output
2341 is padded with spaces to its maximum width, but the details are not
2342 understood. The only observed value for any of these attributes is
2346 @defvr {Attribute} showDay
2347 @defvrx {Attribute} showHour
2348 @defvrx {Attribute} showMinute
2349 @defvrx {Attribute} showSecond
2350 @defvrx {Attribute} showMillis
2351 These attributes presumably control whether each field is displayed
2352 in the output, but the details are not understood. The only
2353 observed value for any of these attributes is @code{true}.
2356 @defvr {Attribute} dayType
2357 This attribute is always @code{month} in the corpus, specifying that
2358 the day of the month is to be displayed; a value of @code{year} is
2359 supposed to indicate that the day of the year, where 1 is January 1,
2360 is to be displayed instead.
2363 @defvr {Attribute} hourFormat
2364 @code{hourFormat}, if present, is one of:
2368 The time is displayed with an @code{am} or @code{pm} suffix, e.g.@:
2372 The time is displayed in a 24-hour format, e.g.@: @code{22:15}.
2374 This is the only value observed in the corpus.
2377 The time is displayed in a 12-hour format, without distinguishing
2378 morning or evening, e.g.@: @code{10;15}.
2381 @code{hourFormat} is sometimes present for @code{elapsedTime} formats,
2382 which is confusing since a time duration does not have a concept of AM
2383 or PM. This might indicate a bug in the code that generated the XML
2384 in the corpus, or it might indicate that @code{elapsedTime} is
2385 sometimes used to format a time of day.
2388 @subsubheading Numeric Attributes
2390 These attributes are used for formats when @code{baseFormat} is
2391 @code{number}. Attributes @code{maximumFractionDigits}, and
2392 @code{minimumFractionDigits}, and @code{useGrouping} are also used
2393 when @code{baseFormat} is @code{elapsedTime}.
2395 @defvr {Attribute} minimumIntegerDigits
2396 Minimum number of digits to display before the decimal point. Always
2397 observed as @code{0}.
2400 @defvr {Attribute} maximumFractionDigits
2401 @defvrx {Attribute} maximumFractionDigits
2402 Maximum or minimum, respectively, number of digits to display after
2403 the decimal point. The observed values of each attribute range from 0
2407 @defvr {Attribute} useGrouping
2408 Whether to use the grouping character to group digits in large
2409 numbers. It would make sense for the grouping character to come from
2410 the @code{separatorChars} attribute, but that attribute is only
2411 present when @code{baseFormat} is @code{dateTime} or
2412 @code{elapsedTime}, in the corpus at least. Perhaps that is because
2413 this attribute has only been observed as @code{false}.
2416 @defvr {Attribute} scientific
2417 This attribute controls when and whether the number is formatted in
2418 scientific notation. It takes the following values:
2422 Use scientific notation only when the number's magnitude is smaller
2423 than the value of the @code{small} attribute.
2426 Use scientific notation when the number will not otherwise fit in the
2430 Always use scientific notation. Not observed in the corpus.
2433 Never use scientific notation. A number that won't otherwise fit will
2434 be replaced by an error indication (see the @code{errorCharacter}
2435 attribute). Not observed in the corpus.
2439 @defvr {Optional} small
2440 Only present when the @code{scientific} attribute is
2441 @code{onlyForSmall}, this is a numeric magnitude below which the
2442 number will be formatted in scientific notation. The values @code{0}
2443 and @code{0.0001} have been observed. The value @code{0} seems like a
2444 pathological choice, since no real number has a magnitude less than 0;
2445 perhaps in practice such a choice is equivalent to setting
2446 @code{scientific} to @code{false}.
2449 @defvr {Optional} prefix
2450 @defvrx {Optional} suffix
2451 Specifies a prefix or a suffix to apply to the formatted number. Only
2452 @code{suffix} has been observed, with value @samp{%}.
2455 @subsubheading String Attributes
2457 These attributes are used for formats when @code{baseFormat} is
2460 @defvr {Attribute} tryStringsAsNumbers
2461 When this is @code{true}, it is supposed to indicate that string
2462 values should be parsed as numbers and then displayed according to
2463 numeric formatting rules. However, in the corpus it is always
2467 @node SPV Detail numberFormat Element
2468 @subsubsection The @code{numberFormat} Element
2470 Parent: @code{setFormat} @*
2471 Contents: @code{affix}@math{+}
2473 This element appears only in schema version 2.5 and earlier
2474 (@pxref{SPV Detail visualization Element}). Possibly this element
2475 could also contain @code{relabel} elements in a more diverse corpus.
2477 This element has the following attributes.
2479 @defvr {Attribute} maximumFractionDigits
2480 @defvrx {Attribute} minimumFractionDigits
2481 @defvrx {Attribute} minimumIntegerDigits
2482 @defvrx {Optional} scientific
2483 @defvrx {Optional} small
2484 @defvrx {Optional} suffix
2485 @defvrx {Optional} useGroupging
2486 The syntax and meaning of these attributes is the same as on the
2487 @code{format} element for a numeric format. @pxref{SPV Detail format
2491 @node SPV Detail stringFormat Element
2492 @subsubsection The @code{stringFormat} Element
2494 Parent: @code{setFormat} @*
2495 Contents: (@code{affix}@math{+} @math{|} @code{relabel}@math{+})?
2497 This element appears only in schema version 2.5 and earlier
2498 (@pxref{SPV Detail visualization Element}).
2500 This element has no attributes.
2502 @node SPV Detail dateTimeFormat Element
2503 @subsubsection The @code{dateTimeFormat} Element
2505 Parent: @code{setFormat} @*
2508 This element appears only in schema version 2.5 and earlier
2509 (@pxref{SPV Detail visualization Element}). Possibly this element
2510 could also contain @code{affix} and @code{relabel} elements in a more
2513 The following attribute is required.
2515 @defvr {Attribute} baseFormat
2516 Either @code{dateTime} or @code{time}.
2519 When @code{baseFormat} is @code{dateTime}, the following attributes
2522 @defvr {Attribute} dayOfMonthPadding
2523 @defvrx {Attribute} dayPadding
2524 @defvrx {Attribute} dayType
2525 @defvrx {Attribute} hourFormat
2526 @defvrx {Attribute} hourPadding
2527 @defvrx {Attribute} mdyOrder
2528 @defvrx {Attribute} minutePadding
2529 @defvrx {Attribute} monthFormat
2530 @defvrx {Attribute} separatorChars
2531 @defvrx {Attribute} showDay
2532 @defvrx {Attribute} showHour
2533 @defvrx {Attribute} showMinute
2534 @defvrx {Attribute} showMonth
2535 @defvrx {Attribute} showSecond
2536 @defvrx {Attribute} showYear
2537 @defvrx {Attribute} yearAbbreviation
2538 The syntax and meaning of these attributes is the same as on the
2539 @code{format} element when that element's @code{baseFormat} is
2540 @code{dateTime}. @pxref{SPV Detail format Element}.
2543 When @code{baseFormat} is @code{time}, the following attributes are
2546 @defvr {Attribute} hourFormat
2547 @defvrx {Attribute} hourPadding
2548 @defvrx {Attribute} minutePadding
2549 @defvrx {Attribute} monthFormat
2550 @defvrx {Attribute} separatorChars
2551 @defvrx {Attribute} showDay
2552 @defvrx {Attribute} showHour
2553 @defvrx {Attribute} showMinute
2554 @defvrx {Attribute} showMonth
2555 @defvrx {Attribute} showSecond
2556 @defvrx {Attribute} showYear
2557 @defvrx {Attribute} yearAbbreviation
2558 The syntax and meaning of these attributes is the same as on the
2559 @code{format} element when that element's @code{baseFormat} is
2560 @code{elapsedTime}. @pxref{SPV Detail format Element}.
2563 @node SPV Detail affix Element
2564 @subsubsection The @code{affix} Element
2566 Parent: @code{format} or @code{numberFormat} or @code{stringFormat} @*
2569 Possibly this element could have @code{dateTimeFormat} as a parent in
2570 a more diverse corpus.
2572 This defines a suffix (or, theoretically, a prefix) for a formatted
2573 value. It is used to insert a reference to a footnote. It has the
2574 following attributes:
2576 @defvr {Attribute} definesReference
2577 This specifies the footnote number as a natural number: 1 for the
2578 first footnote, 2 for the second, and so on.
2581 @defvr {Attribute} position
2582 Position for the footnote label. Always @code{superscript}.
2585 @defvr {Attribute} suffix
2586 Whether the affix is a suffix (@code{true}) or a prefix
2587 (@code{false}). Always @code{true}.
2590 @defvr {Attribute} value
2591 The text of the suffix or prefix. Typically a letter, e.g.@: @code{a}
2592 for footnote 1, @code{b} for footnote 2, @enddots{} The corpus
2593 contains other values: @code{*}, @code{**}, and a few that begin with
2594 at least one comma: @code{,b}, @code{,c}, @code{,,b}, and @code{,,c}.
2597 @node SPV Detail relabel Element
2598 @subsubsection The @code{relabel} Element
2600 Parent: @code{format} or @code{stringFormat} @*
2603 Possibly this element could have @code{numberFormat} or
2604 @code{dateTimeFormat} as a parent in a more diverse corpus.
2606 This specifies how to display a given value. It is used to implement
2607 value labels and to display the system-missing value in a
2608 human-readable way. It has the following attributes:
2610 @defvr {Attribute} from
2611 The value to map. In the corpus this is an integer or the
2612 system-missing value @code{-1.797693134862316E300}.
2615 @defvr {Attribute} to
2616 The string to display in place of the value of @code{from}. In the
2617 corpus this is a wide variety of value labels; the system-missing
2618 value is mapped to @samp{.}.
2621 @node SPV Detail union Element
2622 @subsubsection The @code{union} Element
2624 Parent: @code{setCellProperties} @*
2625 Contents: @code{intersect}@math{+}
2627 This element represents a set of cells, computed as the union of the
2628 sets represented by each of its children.
2630 @subsubheading The @code{intersect} Element
2632 Parent: @code{union} @*
2633 Contents: @code{where}@math{+} @math{|} @code{intersectWhere}?
2635 This element represents a set of cells, computed as the intersection
2636 of the sets represented by each of its children.
2638 Of the two possible children, in the corpus @code{where} is far more
2639 common, appearing thousands of times, whereas @code{intersectWhere}
2640 only appears 4 times.
2642 Most @code{intersect} elements have two or more children.
2644 @subsubheading The @code{where} Element
2646 Parent: @code{intersect} @*
2649 This element represents the set of cells in which the value of a
2650 specified variable falls within a specified set.
2652 @defvr {Attribute} variable
2653 The @code{id} of a variable, e.g.@: @code{dimension0categories} or
2654 @code{dimension0group0map}.
2657 @defvr {Attribute} include
2658 A value, or multiple values separated by semicolons,
2659 e.g.@: @code{0} or @code{13;14;15;16}.
2662 @subsubheading The @code{intersectWhere}
2664 Parent: @code{intersect} @*
2667 The meaning of this element is unknown.
2669 @defvr {Attribute} variable
2670 @defvrx {Attribute} variable2
2671 The meaning of these attributes is unknown. In the four examples in
2672 the corpus they always take the values @code{dimension2categories} and
2673 @code{dimension0categories}, respectively.