1 @node System and Portable Files
2 @chapter System Files and Portable Files
4 The commands in this chapter read, write, and examine system files and
8 * APPLY DICTIONARY:: Apply system file dictionary to active file.
9 * EXPORT:: Write to a portable file.
10 * GET:: Read from a system file.
11 * GET DATA:: Read from foreign files.
12 * IMPORT:: Read from a portable file.
13 * MATCH FILES:: Merge system files.
14 * SAVE:: Write to a system file.
15 * SYSFILE INFO:: Display system file dictionary.
16 * XEXPORT:: Write to a portable file, as a transformation.
17 * XSAVE:: Write to a system file, as a transformation.
20 @node APPLY DICTIONARY
21 @section APPLY DICTIONARY
22 @vindex APPLY DICTIONARY
25 APPLY DICTIONARY FROM=@{'file-name',file_handle@}.
28 @cmd{APPLY DICTIONARY} applies the variable labels, value labels,
29 and missing values taken from a file to corresponding
30 variables in the active file. In some cases it also updates the
33 Specify a system file, portable file, or scratch file with a file name
34 string or as a file handle (@pxref{File Handles}). The dictionary in the
35 file will be read, but it will not replace the active file dictionary.
36 The file's data will not be read.
38 Only variables with names that exist in both the active file and the
39 system file are considered. Variables with the same name but different
40 types (numeric, string) will cause an error message. Otherwise, the
41 system file variables' attributes will replace those in their matching
42 active file variables:
46 If a system file variable has a variable label, then it will replace the
47 active file variable's variable label. If the system file variable does
48 not have a variable label, then the active file variable's variable
49 label, if any, will be retained.
52 If the system file variable has custom attributes (@pxref{VARIABLE
53 ATTRIBUTE}), then those attributes replace the active file variable's
54 custom attributes. If the system file variable does not have custom
55 attributes, then the active file variable's custom attributes, if any,
59 If the active file variable is numeric or short string, then value
60 labels and missing values, if any, will be copied to the active file
61 variable. If the system file variable does not have value labels or
62 missing values, then those in the active file variable, if any, will not
66 In addition to properties of variables, some properties of the active
67 file dictionary as a whole are updated:
71 If the system file has custom attributes (@pxref{DATAFILE ATTRIBUTE}),
72 then those attributes replace the active file variable's custom
76 If the active file has a weighting variable (@pxref{WEIGHT}), and the
77 system file does not, or if the weighting variable in the system file
78 does not exist in the active file, then the active file weighting
79 variable, if any, is retained. Otherwise, the weighting variable in
80 the system file becomes the active file weighting variable.
83 @cmd{APPLY DICTIONARY} takes effect immediately. It does not read the
85 file. The system file is not modified.
94 /UNSELECTED=@{RETAIN,DELETE@}
98 /RENAME=(src_names=target_names)@dots{}
103 The @cmd{EXPORT} procedure writes the active file dictionary and data to a
104 specified portable file or scratch file.
106 By default, cases excluded with FILTER are written to the
107 file. These can be excluded by specifying DELETE on the UNSELECTED
108 subcommand. Specifying RETAIN makes the default explicit.
110 Portable files express real numbers in base 30. Integers are always
111 expressed to the maximum precision needed to make them exact.
112 Non-integers are, by default, expressed to the machine's maximum
113 natural precision (approximately 15 decimal digits on many machines).
114 If many numbers require this many digits, the portable file may
115 significantly increase in size. As an alternative, the DIGITS
116 subcommand may be used to specify the number of decimal digits of
117 precision to write. DIGITS applies only to non-integers.
119 The OUTFILE subcommand, which is the only required subcommand, specifies
120 the portable file or scratch file to be written as a file name string or
121 a file handle (@pxref{File Handles}).
123 DROP, KEEP, and RENAME follow the same format as the SAVE procedure
126 The TYPE subcommand specifies the character set for use in the
127 portable file. Its value is currently not used.
129 The MAP subcommand is currently ignored.
131 @cmd{EXPORT} is a procedure. It causes the active file to be read.
139 /FILE=@{'file-name',file_handle@}
142 /RENAME=(src_names=target_names)@dots{}
145 @cmd{GET} clears the current dictionary and active file and
146 replaces them with the dictionary and data from a specified file.
148 The FILE subcommand is the only required subcommand. Specify the system
149 file, portable file, or scratch file to be read as a string file name or
150 a file handle (@pxref{File Handles}).
152 By default, all the variables in a file are read. The DROP
153 subcommand can be used to specify a list of variables that are not to be
154 read. By contrast, the KEEP subcommand can be used to specify variable
155 that are to be read, with all other variables not read.
157 Normally variables in a file retain the names that they were
158 saved under. Use the RENAME subcommand to change these names. Specify,
159 within parentheses, a list of variable names followed by an equals sign
160 (@samp{=}) and the names that they should be renamed to. Multiple
161 parenthesized groups of variable names can be included on a single
162 RENAME subcommand. Variables' names may be swapped using a RENAME
163 subcommand of the form @samp{/RENAME=(A B=B A)}.
165 Alternate syntax for the RENAME subcommand allows the parentheses to be
166 eliminated. When this is done, only a single variable may be renamed at
167 once. For instance, @samp{/RENAME=A=B}. This alternate syntax is
170 DROP, KEEP, and RENAME are executed in left-to-right order.
171 Each may be present any number of times. @cmd{GET} never modifies a
172 file on disk. Only the active file read from the file
173 is affected by these subcommands.
175 @cmd{GET} does not cause the data to be read, only the dictionary. The data
176 is read later, when a procedure is executed.
178 Use of @cmd{GET} to read a portable file or scratch file is a PSPP
187 /TYPE=@{GNM,PSQL,TXT@}
188 @dots{}additional subcommands depending on TYPE@dots{}
191 The @cmd{GET DATA} command is used to read files and other data sources
192 created by other applications.
193 When this command is executed, the current dictionary and active file are
194 replaced with variables and data read from the specified source.
196 The TYPE subcommand is mandatory and must be the first subcommand
197 specified. It determines the type of the file or source to read.
198 PSPP currently supports the following file types:
202 Spreadsheet files created by Gnumeric (@url{http://gnumeric.org}).
205 Relations from PostgreSQL databases (@url{http://postgresql.org}).
208 Textual data files in columnar and delimited formats.
211 Each supported file type has additional subcommands, explained in
212 separate sections below.
215 * GET DATA /TYPE=GNM::
216 * GET DATA /TYPE=PSQL::
217 * GET DATA /TYPE=TXT::
220 @node GET DATA /TYPE=GNM
221 @subsection Gnumeric Spreadsheet Files
225 /FILE=@{'file-name'@}
226 /SHEET=@{NAME 'sheet-name', INDEX n@}
227 /CELLRANGE=@{RANGE 'range', FULL@}
228 /READNAMES=@{ON, OFF@}
233 @cindex spreadsheet files
234 To use GET DATA to read a spreadsheet file created by Gnumeric
235 (@url{http://gnumeric.org}), specify TYPE=GNM to indicate the file's
236 format and use FILE to indicate the Gnumeric file to be read. All
237 other subcommands are optional.
239 The format of each variable is determined by the format of the spreadsheet
240 cell containing the first datum for the variable.
241 If this cell is of string (text) format, then the width of the variable is
242 determined from the length of the string it contains, unless the
243 ASSUMEDVARWIDTH subcommand is given.
246 The FILE subcommand is mandatory. Specify the name of the file
249 The SHEET subcommand specifies the sheet within the spreadsheet file to read.
250 There are two forms of the SHEET subcommand.
252 @samp{/SHEET=name @var{sheet-name}}, the string @var{sheet-name} is the
253 name of the sheet to read.
254 In the second form, @samp{/SHEET=index @var{idx}}, @var{idx} is a
255 integer which is the index of the sheet to read.
256 The first sheet has the index 1.
257 If the SHEET subcommand is omitted, then the command will read the
258 first sheet in the file.
260 The CELLRANGE subcommand specifies the range of cells within the sheet to read.
261 If the subcommand is given as @samp{/CELLRANGE=FULL}, then the entire
263 To read only part of a sheet, use the form
264 @samp{/CELLRANGE=range '@var{top-left-cell}:@var{bottom-right-cell}'}.
265 For example, the subcommand @samp{/CELLRANGE=range 'C3:P19'} reads
266 columns C--P, and rows 3--19 inclusive.
267 If no CELLRANGE subcommand is given, then the entire sheet is read.
269 If @samp{/READNAMES=ON} is specified, then the contents of cells of
270 the first row are used as the names of the variables in which to store
271 the data from subsequent rows.
272 If the READNAMES command is omitted, or if @samp{/READNAMES=OFF} is
273 used, then the variables receive automatically assigned names.
275 The ASSUMEDVARWIDTH subcommand specifies the maximum width of string
276 variables read from the file.
277 If omitted, the default value is determined from the length of the
278 string in the first spreadsheet cell for each variable.
281 @node GET DATA /TYPE=PSQL
282 @subsection Postgres Database Queries
286 /CONNECT=@{connection info@}
296 The PSQL type is used to import data from a postgres database server.
297 The server may be located locally or remotely.
298 Variables are automatically created based on the table column names
299 or the names specified in the SQL query.
300 Postgres data types of high precision, will loose precision when
302 Not all the postgres data types are able to be represented in PSPP.
303 If a datum cannot be represented a warning will be issued and that
304 datum will be set to SYSMIS.
306 The CONNECT subcommand is mandatory.
307 It is a string specifying the parameters of the database server from
308 which the data should be fetched.
309 The format of the string is given in the postgres manual
310 @url{http://www.postgresql.org/docs/8.0/static/libpq.html#LIBPQ-CONNECT}.
312 The SQL subcommand is mandatory.
313 It must be a valid SQL string to retrieve data from the database.
315 The ASSUMEDVARWIDTH subcommand specifies the maximum width of string
316 variables read from the database.
317 If omitted, the default value is determined from the length of the
318 string in the first value read for each variable.
320 The UNENCRYPTED subcommand allows data to be retrieved over an insecure
322 If the connection is not encrypted, and the UNENCRYPTED subcommand is not
323 given, then an error will occur.
324 Whether or not the connection is
325 encrypted depends upon the underlying psql library and the
326 capabilities of the database server.
328 The BSIZE subcommand serves only to optimise the speed of data transfer.
329 It specifies an upper limit on
330 number of cases to fetch from the database at once.
331 The default value is 4096.
332 If your SQL statement fetches a large number of cases but only a small number of
333 variables, then the data transfer may be faster if you increase this value.
334 Conversely, if the number of variables is large, or if the machine on which
335 PSPP is running has only a
336 small amount of memory, then a smaller value will be better.
339 The following syntax is an example:
342 /CONNECT='host=example.com port=5432 dbname=product user=fred passwd=xxxx'
343 /SQL='select * from manufacturer'.
347 @node GET DATA /TYPE=TXT
348 @subsection Textual Data Files
352 /FILE=@{'file-name',file_handle@}
353 [/ARRANGEMENT=@{DELIMITED,FIXED@}]
354 [/FIRSTCASE=@{first_case@}]
355 [/IMPORTCASE=@{ALL,FIRST max_cases,PERCENT percent@}]
356 @dots{}additional subcommands depending on ARRANGEMENT@dots{}
361 When TYPE=TXT is specified, GET DATA reads data in a delimited or
362 fixed columnar format, much like DATA LIST (@pxref{DATA LIST}).
364 The FILE subcommand is mandatory. Specify the file to be read as
365 a string file name or (for textual data
366 only) a file handle (@pxref{File Handles}).
368 The ARRANGEMENT subcommand determines the file's basic format.
369 DELIMITED, the default setting, specifies that fields in the input
370 data are separated by spaces, tabs, or other user-specified
371 delimiters. FIXED specifies that fields in the input data appear at
372 particular fixed column positions within records of a case.
374 By default, cases are read from the input file starting from the first
375 line. To skip lines at the beginning of an input file, set FIRSTCASE
376 to the number of the first line to read: 2 to skip the first line, 3
377 to skip the first two lines, and so on.
379 IMPORTCASE can be used to limit the number of cases read from the
380 input file. With the default setting, ALL, all cases in the file are
381 read. Specify FIRST @i{max_cases} to read at most @i{max_cases} cases
382 from the file. Use PERCENT @i{percent} to read only @i{percent}
383 percent, approximately, of the cases contained in the file. (The
384 percentage is approximate, because there is no way to accurately count
385 the number of cases in the file without reading the entire file. The
386 number of cases in some kinds of unusual files cannot be estimated;
387 PSPP will read all cases in such files.)
389 FIRSTCASE and IMPORTCASE may be used with delimited and fixed-format
390 data. The remaining subcommands, which apply only to one of the two file
391 arrangements, are described below.
394 * GET DATA /TYPE=TXT /ARRANGEMENT=DELIMITED::
395 * GET DATA /TYPE=TXT /ARRANGEMENT=FIXED::
398 @node GET DATA /TYPE=TXT /ARRANGEMENT=DELIMITED
399 @subsubsection Reading Delimited Data
403 /FILE=@{'file-name',file_handle@}
404 [/ARRANGEMENT=@{DELIMITED,FIXED@}]
405 [/FIRSTCASE=@{first_case@}]
406 [/IMPORTCASE=@{ALL,FIRST max_cases,PERCENT percent@}]
408 /DELIMITERS="delimiters"
409 [/QUALIFIER="quotes" [/ESCAPE]]
410 [/DELCASE=@{LINE,VARIABLES n_variables@}]
411 /VARIABLES=del_var [del_var]@dots{}
412 where each del_var takes the form:
416 The GET DATA command with TYPE=TXT and ARRANGEMENT=DELIMITED reads
417 input data from text files in delimited format, where fields are
418 separated by a set of user-specified delimiters. Its capabilities are
419 similar to those of DATA LIST FREE (@pxref{DATA LIST FREE}), with a
422 The required FILE subcommand and optional FIRSTCASE and IMPORTCASE
423 subcommands are described above (@pxref{GET DATA /TYPE=TXT}).
425 DELIMITERS, which is required, specifies the set of characters that
426 may separate fields. Each character in the string specified on
427 DELIMITERS separates one field from the next. The end of a line also
428 separates fields, regardless of DELIMITERS. Two consecutive
429 delimiters in the input yield an empty field, as does a delimiter at
430 the end of a line. A space character as a delimiter is an exception:
431 consecutive spaces do not yield an empty field and neither does any
432 number of spaces at the end of a line.
434 To use a tab as a delimiter, specify @samp{\t} at the beginning of the
435 DELIMITERS string. To use a backslash as a delimiter, specify
436 @samp{\\} as the first delimiter or, if a tab should also be a
437 delimiter, immediately following @samp{\t}. To read a data file in
438 which each field appears on a separate line, specify the empty string
441 The optional QUALIFIER subcommand names one or more characters that
442 can be used to quote values within fields in the input. A field that
443 begins with one of the specified quote characters ends at the next
444 matching quote. Intervening delimiters become part of the field,
445 instead of terminating it. The ability to specify more than one quote
446 character is a PSPP extension.
448 By default, a character specified on QUALIFIER cannot itself be
449 embedded within a field that it quotes, because the quote character
450 always terminates the quoted field. With ESCAPE, however, a doubled
451 quote character within a quoted field inserts a single instance of the
452 quote into the field. For example, if @samp{'} is specified on
453 QUALIFIER, then without ESCAPE @code{'a''b'} specifies a pair of
454 fields that contain @samp{a} and @samp{b}, but with ESCAPE it
455 specifies a single field that contains @samp{a'b}. ESCAPE is a PSPP
458 The DELCASE subcommand controls how data may be broken across lines in
459 the data file. With LINE, the default setting, each line must contain
460 all the data for exactly one case. For additional flexibility, to
461 allow a single case to be split among lines or multiple cases to be
462 contained on a single line, specify VARIABLES @i{n_variables}, where
463 @i{n_variables} is the number of variables per case.
465 The VARIABLES subcommand is required and must be the last subcommand.
466 Specify the name of each variable and its input format (@pxref{Input
467 and Output Formats}) in the order they should be read from the input
470 @subsubheading Examples
473 On a Unix-like system, the @samp{/etc/passwd} file has a format
477 root:$1$nyeSP5gD$pDq/:0:0:,,,:/root:/bin/bash
478 blp:$1$BrP/pFg4$g7OG:1000:1000:Ben Pfaff,,,:/home/blp:/bin/bash
479 john:$1$JBuq/Fioq$g4A:1001:1001:John Darrington,,,:/home/john:/bin/bash
480 jhs:$1$D3li4hPL$88X1:1002:1002:Jason Stover,,,:/home/jhs:/bin/csh
484 The following syntax reads a file in the format used by
487 @c If you change this example, change the regression test in
488 @c tests/command/get-data-txt-examples.sh to match.
490 GET DATA /TYPE=TXT /FILE='/etc/passwd' /DELIMITERS=':'
491 /VARIABLES=username A20
501 Consider the following data on used cars:
504 model year mileage price type age
505 Civic 2002 29883 15900 Si 2
506 Civic 2003 13415 15900 EX 1
507 Civic 1992 107000 3800 n/a 12
508 Accord 2002 26613 17900 EX 1
512 The following syntax can be used to read the used car data:
514 @c If you change this example, change the regression test in
515 @c tests/command/get-data-txt-examples.sh to match.
517 GET DATA /TYPE=TXT /FILE='cars.data' /DELIMITERS=' ' /FIRSTCASE=2
527 Consider the following information on animals in a pet store:
530 'Pet''s Name', "Age", "Color", "Date Received", "Price", "Height", "Type"
531 , (Years), , , (Dollars), ,
532 "Rover", 4.5, Brown, "12 Feb 2004", 80, '1''4"', "Dog"
533 "Charlie", , Gold, "5 Apr 2007", 12.3, "3""", "Fish"
534 "Molly", 2, Black, "12 Dec 2006", 25, '5"', "Cat"
535 "Gilly", , White, "10 Apr 2007", 10, "3""", "Guinea Pig"
539 The following syntax can be used to read the pet store data:
541 @c If you change this example, change the regression test in
542 @c tests/command/get-data-txt-examples.sh to match.
544 GET DATA /TYPE=TXT /FILE='pets.data' /DELIMITERS=', ' /QUALIFIER='''"' /ESCAPE
555 @node GET DATA /TYPE=TXT /ARRANGEMENT=FIXED
556 @subsubsection Reading Fixed Columnar Data
560 /FILE=@{'file-name',file_handle@}
561 [/ARRANGEMENT=@{DELIMITED,FIXED@}]
562 [/FIRSTCASE=@{first_case@}]
563 [/IMPORTCASE=@{ALL,FIRST max_cases,PERCENT percent@}]
566 /VARIABLES fixed_var [fixed_var]@dots{}
567 [/rec# fixed_var [fixed_var]@dots{}]@dots{}
568 where each fixed_var takes the form:
569 variable start-end format
572 The GET DATA command with TYPE=TXT and ARRANGEMENT=FIXED reads input
573 data from text files in fixed format, where each field is located in
574 particular fixed column positions within records of a case. Its
575 capabilities are similar to those of DATA LIST FIXED (@pxref{DATA LIST
576 FIXED}), with a few enhancements.
578 The required FILE subcommand and optional FIRSTCASE and IMPORTCASE
579 subcommands are described above (@pxref{GET DATA /TYPE=TXT}).
581 The optional FIXCASE subcommand may be used to specify the positive
582 integer number of input lines that make up each case. The default
585 The VARIABLES subcommand, which is required, specifies the positions
586 at which each variable can be found. For each variable, specify its
587 name, followed by its start and end column separated by @samp{-}
588 (e.g.@: @samp{0-9}), followed by the input format type (e.g.@:
589 @samp{F}). For this command, columns are numbered starting from 0 at
590 the left column. Introduce the variables in the second and later
591 lines of a case by a slash followed by the number of the line within
592 the case, e.g.@: @samp{/2} for the second line.
594 @subsubheading Examples
597 Consider the following data on used cars:
600 model year mileage price type age
601 Civic 2002 29883 15900 Si 2
602 Civic 2003 13415 15900 EX 1
603 Civic 1992 107000 3800 n/a 12
604 Accord 2002 26613 17900 EX 1
608 The following syntax can be used to read the used car data:
610 @c If you change this example, change the regression test in
611 @c tests/command/get-data-txt-examples.sh to match.
613 GET DATA /TYPE=TXT /FILE='cars.data' /ARRANGEMENT=FIXED /FIRSTCASE=2
614 /VARIABLES=model 0-7 A
632 /RENAME=(src_names=target_names)@dots{}
635 The @cmd{IMPORT} transformation clears the active file dictionary and
637 replaces them with a dictionary and data from a system, portable file,
640 The FILE subcommand, which is the only required subcommand, specifies
641 the portable file to be read as a file name string or a file handle
642 (@pxref{File Handles}).
644 The TYPE subcommand is currently not used.
646 DROP, KEEP, and RENAME follow the syntax used by @cmd{GET} (@pxref{GET}).
648 @cmd{IMPORT} does not cause the data to be read, only the dictionary. The
649 data is read later, when a procedure is executed.
651 Use of @cmd{IMPORT} to read a system file or scratch file is a PSPP
660 /@{FILE,TABLE@}=@{*,'file-name'@}
661 /RENAME=(src_names=target_names)@dots{}
672 @cmd{MATCH FILES} merges one or more system, portable, or scratch files,
674 including the active file. Cases with the same values for BY
675 variables are combined into a single case. Cases with different
676 values are output in order. Thus, multiple sorted files are
677 combined into a single sorted file based on the value of the BY
678 variables. The results of the merge become the new active file.
680 Specify FILE with a system, portable, or scratch file as a file name
681 string or file handle
682 (@pxref{File Handles}), or with an asterisk (@samp{*}) to
683 indicate the current active file. The files specified on FILE are
684 merged together based on the BY variables, or combined case-by-case if
687 Specify TABLE with a file to use it as a @dfn{table
688 lookup file}. Cases in table lookup files are not used up after
689 they've been used once. This means that data in table lookup files can
690 correspond to any number of cases in FILE files. Table lookup files
691 correspond to lookup tables in traditional relational database systems.
692 If a table lookup file contains more than one case with a given set of
693 BY variables, only the first case is used.
695 Any number of FILE and TABLE subcommands may be specified.
696 Ordinarily, at least two FILE subcommands, or one FILE and at least
697 one TABLE, should be specified. Each instance of FILE or TABLE can be
698 followed by any sequence of RENAME subcommands. These have the same
699 form and meaning as the corresponding subcommands of @cmd{GET}
700 (@pxref{GET}), but apply only to variables in the given file.
702 Each FILE or TABLE may optionally be followed by an IN subcommand,
703 which creates a numeric variable with the specified name and format
704 F1.0. The IN variable takes value 1 in a case if the given file
705 contributed a row to the merged file, 0 otherwise. The DROP, KEEP,
706 and RENAME subcommands do not affect IN variables.
708 When more than one FILE or TABLE contains a variable with a given
709 name, those variables must all have the same type (numeric or string)
710 and, for string variables, the same width. This rules applies to
711 variable names after renaming with RENAME; thus, RENAME can be used to
714 FILE and TABLE must be specified at the beginning of the command, with
715 any RENAME or IN specifications immediately after the corresponding
716 FILE or TABLE. These subcommands are followed by BY, DROP, KEEP,
717 FIRST, LAST, and MAP.
719 The BY subcommand specifies a list of variables that are used to match
720 cases from each of the files. When TABLE or IN is used, BY is
721 required; otherwise, it is optional. When BY is specified, all the
722 files named on FILE and TABLE subcommands must be sorted in ascending
723 order of the BY variables. Variables belonging to files that are not
724 present for the current case are set to the system-missing value for
725 numeric variables or spaces for string variables.
727 The DROP and KEEP subcommands allow variables to be dropped from or
728 reordered within the new active file. These subcommands have the same
729 form and meaning as the corresponding subcommands of @cmd{GET}
730 (@pxref{GET}). They apply to the new active file as a whole, not to
731 individual input files. The variable names specified on DROP and KEEP
732 are those after any renaming with RENAME.
734 The optional FIRST and LAST subcommands name variables that @cmd{MATCH
735 FILES} adds to the active file. The new variables are numeric with
736 print and write format F1.0. The value of the FIRST variable is 1 in
737 the first case with a given set of values for the BY variables, and 0
738 in other cases. Similarly, the LAST variable is 1 in the last case
739 with a given of BY values, and 0 in other cases.
741 @cmd{MATCH FILES} may not be specified following @cmd{TEMPORARY}
742 (@pxref{TEMPORARY}) if the active file is used as an input source.
744 Use of portable or scratch files on @cmd{MATCH FILES} is a PSPP
753 /OUTFILE=@{'file-name',file_handle@}
754 /UNSELECTED=@{RETAIN,DELETE@}
755 /@{COMPRESSED,UNCOMPRESSED@}
756 /PERMISSIONS=@{WRITEABLE,READONLY@}
760 /RENAME=(src_names=target_names)@dots{}
765 The @cmd{SAVE} procedure causes the dictionary and data in the active
767 be written to a system file or scratch file.
769 OUTFILE is the only required subcommand. Specify the system file or
770 scratch file to be written as a string file name or a file handle
771 (@pxref{File Handles}).
773 By default, cases excluded with FILTER are written to the system file.
774 These can be excluded by specifying DELETE on the UNSELECTED
775 subcommand. Specifying RETAIN makes the default explicit.
777 The COMPRESS and UNCOMPRESS subcommand determine whether the saved
778 system file is compressed. By default, system files are compressed.
779 This default can be changed with the SET command (@pxref{SET}).
781 The PERMISSIONS subcommand specifies permissions for the new system
782 file. WRITEABLE, the default, creates the file with read and write
783 permission. READONLY creates the file for read-only access.
785 By default, all the variables in the active file dictionary are written
786 to the system file. The DROP subcommand can be used to specify a list
787 of variables not to be written. In contrast, KEEP specifies variables
788 to be written, with all variables not specified not written.
790 Normally variables are saved to a system file under the same names they
791 have in the active file. Use the RENAME subcommand to change these names.
792 Specify, within parentheses, a list of variable names followed by an
793 equals sign (@samp{=}) and the names that they should be renamed to.
794 Multiple parenthesized groups of variable names can be included on a
795 single RENAME subcommand. Variables' names may be swapped using a
796 RENAME subcommand of the form @samp{/RENAME=(A B=B A)}.
798 Alternate syntax for the RENAME subcommand allows the parentheses to be
799 eliminated. When this is done, only a single variable may be renamed at
800 once. For instance, @samp{/RENAME=A=B}. This alternate syntax is
803 DROP, KEEP, and RENAME are performed in left-to-right order. They
804 each may be present any number of times. @cmd{SAVE} never modifies
805 the active file. DROP, KEEP, and RENAME only affect the system file
808 The VERSION subcommand specifies the version of the file format. Valid
809 versions are 2 and 3. The default version is 3. In version 2 system
810 files, variable names longer than 8 bytes will be truncated. The two
811 versions are otherwise identical.
813 The NAMES and MAP subcommands are currently ignored.
815 @cmd{SAVE} causes the data to be read. It is a procedure.
818 @section SYSFILE INFO
822 SYSFILE INFO FILE='file-name'.
825 @cmd{SYSFILE INFO} reads the dictionary in a system file and
826 displays the information in its dictionary.
828 Specify a file name or file handle. @cmd{SYSFILE INFO} reads that file as
829 a system file and displays information on its dictionary.
831 @cmd{SYSFILE INFO} does not affect the current active file.
843 /RENAME=(src_names=target_names)@dots{}
848 The @cmd{EXPORT} transformation writes the active file dictionary and
849 data to a specified portable file.
851 This transformation is a PSPP extension.
853 It is similar to the @cmd{EXPORT} procedure, with two differences:
857 @cmd{XEXPORT} is a transformation, not a procedure. It is executed when
858 the data is read by a procedure or procedure-like command.
861 @cmd{XEXPORT} does not support the UNSELECTED subcommand.
864 @xref{EXPORT}, for more information.
873 /@{COMPRESSED,UNCOMPRESSED@}
874 /PERMISSIONS=@{WRITEABLE,READONLY@}
878 /RENAME=(src_names=target_names)@dots{}
883 The @cmd{XSAVE} transformation writes the active file dictionary and
884 data to a system file or scratch file. It is similar to the @cmd{SAVE}
885 procedure, with two differences:
889 @cmd{XSAVE} is a transformation, not a procedure. It is executed when
890 the data is read by a procedure or procedure-like command.
893 @cmd{XSAVE} does not support the UNSELECTED subcommand.
896 @xref{SAVE}, for more information.