Chapter Contents


SAS Companion for the OS/390 Environment

Accessing SPSS Files

The SPSS engine supports native and portable file formats for both SPSS and SPSS-X files. The engine automatically determines which type of SPSS file it is reading and reads the file accordingly.

This engine can read only SPSS data files that were created under the same operating environment. For example, the SPSS engine under OS/390 cannot read SPSS files that were created under the OpenVMS operating environment. The only exception is an SPSS portable file, which can originate from any operating environment.

Assigning a Libref to an SPSS File

In order to access an SPSS file, you must use the LIBNAME statement or LIBNAME function to assign a libref to the file. Specify the SPSS engine in the LIBNAME statement as follows:

LIBNAME libref SPSS 'physical-filename';

is a SAS libref.

is the SPSS engine.

is the physical file name of the SPSS file.

The syntax of the LIBNAME function for SPSS is as follows:

LIBNAME(libref, 'physical-filename', 'SPSS');

You do not need to use a LIBNAME statement or function before running PROC CONVERT if you are using PROC CONVERT to convert an SPSS file to a SAS data file. (See CONVERT.)

Note that the LIBNAME statement and function have no options for the SPSS engine.

If you previously used a TSO ALLOC command or a JCL DD statement to assign a DDname to the SPSS file, you can omit the physical-filename in the LIBNAME statement or function and use the DDname as the libref. (See the second example in Examples of Accessing SPSS Files.)

Referencing SPSS Files

SPSS data files do not have names. For these files, use a member name of your choice in SAS programs.

SPSS data files have only one logical member per file. Therefore, you can use _FIRST_ in your SAS programs to refer to the first data file.

Examples of Accessing SPSS Files

Suppose you want to read the physical file MY.SPSSX.FILE. The following statements assign a libref to the data set and then run PROC CONTENTS and PROC PRINT on the SPSS file:

libname xxx spss 'my.spssx.file';
proc contents data=xxx._first_;
proc print data=xxx._first_;

In the next example, the TSO ALLOC command associates a DDname with the name of the physical file that comprises the SPSS physical-filename. The physical file name is omitted in the LIBNAME statement, because the libref that is used is the same as the DDname in the TSO command. The PROC PRINT statement prints the data in the first member of the SPSS data file.

tso alloc f(xxx) da('my.spssx.file') shr reu;
libname xxx spss;
proc print data=xxx._first_;

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.