Previous: GET DATA /TYPE=PSQL, Up: GET DATA


9.4.3 Textual Data Files

     GET DATA /TYPE=TXT
             /FILE={'file_name',file_handle}
             [ENCODING='encoding']
             [/ARRANGEMENT={DELIMITED,FIXED}]
             [/FIRSTCASE={first_case}]
             [/IMPORTCASE={ALL,FIRST max_cases,PERCENT percent}]
             ...additional subcommands depending on ARRANGEMENT...

When TYPE=TXT is specified, GET DATA reads data in a delimited or fixed columnar format, much like DATA LIST (see DATA LIST).

The FILE subcommand is mandatory. Specify the file to be read as a string file name or (for textual data only) a file handle (see File Handles).

The ENCODING subcommand specifies the character encoding of the file to be read. See INSERT, for information on supported encodings.

The ARRANGEMENT subcommand determines the file's basic format. DELIMITED, the default setting, specifies that fields in the input data are separated by spaces, tabs, or other user-specified delimiters. FIXED specifies that fields in the input data appear at particular fixed column positions within records of a case.

By default, cases are read from the input file starting from the first line. To skip lines at the beginning of an input file, set FIRSTCASE to the number of the first line to read: 2 to skip the first line, 3 to skip the first two lines, and so on.

IMPORTCASE can be used to limit the number of cases read from the input file. With the default setting, ALL, all cases in the file are read. Specify FIRST max_cases to read at most max_cases cases from the file. Use PERCENT percent to read only percent percent, approximately, of the cases contained in the file. (The percentage is approximate, because there is no way to accurately count the number of cases in the file without reading the entire file. The number of cases in some kinds of unusual files cannot be estimated; pspp will read all cases in such files.)

FIRSTCASE and IMPORTCASE may be used with delimited and fixed-format data. The remaining subcommands, which apply only to one of the two file arrangements, are described below.