Output Drivers
PSPP has output drivers for several formats. This section documents the supported formats and how they can be configured:
- Text Output (
.txtand.text) - PDF Output (
.pdf) - HTML Output (
.htmand.html) - Comma-Separated Value Output (
.csv) - JSON Output (
.json) - SPSS Viewer Output (
.spv) - System File Output (
.sav) - Portable File Output (
.por)
Text Output (.txt and .text)
PSPP can produce plain text output, drawing boxes using ASCII or Unicode line drawing characters.
Plain text output is encoded in UTF-8.
This driver has the following options:
-
width = <columns>
Sets the maximum page width to the specified number of columns. To fit in the given width, output table columns will be word-wrapped or, if necessary, tables will be broken into multiple chunks. The default is no maximum width. -
boxes = "unicode"
boxes = "ascii"
Sets the style used for boxes in the output. The following shows an example of each style:unicode ascii ┌────┬────┐ +----+----+ │ │ │ | | | ├────┼────┤ +----+----+ │ │ │ | | | └────┴────┘ +----+----+Unicode boxes are generally more attractive but they can be harder to work with in some environments. The default is
unicode. -
emphasis = <bool>
If this is set to true, then the output includes bold and underline emphasis with overstriking. This is supported by only some software, mainly on Unix. The default isfalse.
PDF Output (.pdf)
This driver has the following options:
-
page_setup = <PageSetup>
Sets the page size, margins, and other parameters. The following sub-options are available:-
initial_page_number = <number>
The page number to use for the first page of output. The default is 1. -
paper = "<size>"
Sets the page size.<size>takes the form<w>x<h><unit>, e.g.8.5x11inor210x297mm, or the name of a standard paper size, such asletterora4. The default is system- and user-dependent. -
margins = "<trbl>"
margins = ["<tb>", "<lr>"]
margins = ["<t>", "<rl>", "<b>"]
margins = ["<t>", "<r>", "<b>", "<l>"]
Sets the margins. Each variable is a quoted string with a length and a unit, e.g.10mm. The one-value form sets all margins to the same length; the two-value form sets the top and bottom margins separately from left and right; and so on. The default is0.5in. -
orientation = "portrait"
orientation = "landscape"
Controls the output page orientation. The default is"portrait". -
object_spacing = "<length>"
Sets the vertical spacing between output objects, such as tables or text.<length>includes a length and a unit, e.g.10mm. The default is12pt, or 1/6 of an inch. -
chart_spacing = "as_is"
chart_spacing = "full_height"
chart_spacing = "half_height"
chart_spacing = "quarter_height"
Sets the size of charts and graphs in the output. The default,"as_is", uses the size specified in the charts themselves. The other possibilities set chart size in terms of the height of the page. -
header = "<heading>"
footer = "<heading>"
Sets the header, output at the top of each page, and the footer, output at the bottom of each page. Both header and footer are expressed in HTML. Only simple HTML features are supported, including the following HTML elements:-
<html>, optionally, as a top-level element. -
<head>, optionally, as a first element enclosing a<style>element with simple CSS. Only the following CSS properties, forpelements only, are supported:-
color: an RGB value, e.g.#RRGGBB. -
font-weight: eitherboldornormal. -
font-style: eitheritalicornormal. -
text-decoration: eitherunderlineornormal. -
font-family: a font name. -
font-size: a font size1.
-
-
<p>, optionally, for dividing text into multiple paragraphs. Thealignattribute is honored, as is thetext_alignproperty on thestyleattribute. -
<br>for breaking a paragraph into lines. Line breaks inside HTML are also treated as breaks. -
<b>,<i>,<u>,<strike>,<strong>, and<em>for styling text. -
<font>, with attributesface,color, andsize1. -
Other elements are accepted but ignored.
Text in a header or footer may include any of the following variable references, which are expanded at output time:
-
&[Date]
&[Time]
The current date or time in the preferred format for the locale. -
&[Head1]
&[Head2]
&[Head3]
&[Head4]
The name of the first-, second-, third-, or fourth-level heading corresponding to the first output item that appears on the page with the header or footer. -
&[PageTitle]
The title set with theTITLEcommand. -
&[Filename]
Name of the output file. -
&[Page]
The page number.
The following example shows how to put a centered title at the top of each page and a right-justified page number at the bottom:
header = '<p align="center">&[PageTitle]</p>' footer = '<p align="right">Page &[Page]</p>' -
-
HTML Output (.htm and .html)
PSPP can produce HTML output.
HTML output is encoded in UTF-8.
This driver currently has no options.
Comma-Separated Value Output (.csv)
PSPP can produce output in comma-separated value format.
CSV output is encoded in UTF-8.
This driver has the following general options:
-
quote = "<char>"
A single character for quoting multi-line fields and fields that contain the delimiter. The default is". -
delimiter = "<char>"
A single character to separate fields. The default is,.
The following additional options only affect output written by pspp convert:
-
var_names = false
By default,pspp convertwrites the variable names as the first line of output. With this option,pspp convertomits this line. -
recode = true
By default,pspp convertwrites user-missing values to CSV output files as their regular values. This options makespspp convertwrite them the same way as system-missing values (as a single space). -
labels = true
By default,pspp convertwrites variables' values to CSV output files. With this option,pspp convertwrites value labels. -
print_formats = true
By default,pspp convertwrites numeric variables as plain numbers. This option makespspp converthonor variables' print formats. -
decimal = "<char>"
This option sets the character used as a decimal point in output. The default is..
JSON Output (.json)
PSPP can produce output in JSON format.
CSV output is encoded in UTF-8.
This driver currently has no options.
SPSS Viewer Output (.spv)
PSPP can produce output in SPSS Viewer format.
This driver has the following options:
page_setup = <PageSetup>
Sets the page size, margins, and other parameters.<PageSetup>has the same form documented for PDF format.
System File Output (.sav)
PSPP can produce output in the form of SPSS system files, which
usually have a .sav extension.
This driver has the following options:
-
compression = "<compression>"
Sets the kind of compression used for writing data in the system file.<compression>must be one of the following:-
simple: Uses a simple form of compression that saves space writing small integer values and string segments that are all spaces. All versions of SPSS support simple compression. -
zlib: Uses more advanced compression that saves space in more general cases. Only SPSS 21 and later can read files written withzlibcompression.
-
Portable File Output (.por)
PSPP can produce output in the form of SPSS portable files, which
usually have a .por extension.
The portable file format is mostly obsolete. The "system file" or .sav format should be used for writing new data files.
This driver has no options.