SAS 9.1 provides three interface library engines that enable you to access external data files directly from a SAS program: the BMDP, OSIRIS, and SPSS engines. These engines are all read-only. Because they are sequential engines (that is, they do not support random access of data), these engines cannot be used with the POINT= option in the SET statement or with the FSBROWSE, FSEDIT, or FSVIEW procedures. You can use PROC COPY or a DATA step to copy the system file to a SAS data set and then perform these functions on the SAS data set. Also, because they are sequential engines, some procedures (such as the PRINT procedure) give a warning message that the engine is sequential. With these engines, the physical filename that is associated with a libref is an actual filename, not a folder. This is an exception to the rules concerning librefs.
You can also use the CONVERT procedure to convert BMDP, OSIRIS, and SPSS files to SAS data files. For more information, see 'CONVERT Procedure' on page 426.
The BMDP interface library engine enables you to read BMDP DOS files from the BMDP statistical software package directly from a SAS program. The following sections assume that you are familiar with the BMDP save file terminology.
To read a BMDP save file, you must issue a LIBNAME statement that explicitly specifies that you want to use the BMDP engine:
LIBNAME libref BMDP <'filename'>;
In this form of the LIBNAME statement, libref is a SAS libref and filename is the BMDP physical filename. If the libref appears previously as a fileref, you can omit filename because the physical filename that is associated with the fileref is used. This engine can read only BMDP save files created under DOS.
Because there can be multiple save files in a single physical file, you reference the CODE= value as the member name of the data set within the SAS language. For example, if the save file contains CODE=ABC and CODE=DEF and the libref is MYLIB, you reference them as MYLIB.ABC and MYLIB.DEF. All CONTENT types are treated the same. Therefore, even if member DEF is CONTENT=CORR, it is treated as CONTENT=DATA.
If you know that you want to access the first save file in the physical file, or if there is only one save file, you can refer to the member name as _FIRST_. This is convenient if you do not know the CODE= value.
In the following example, the physical file MYBMDP.DAT contains the save file ABC. This example associates the libref MYLIB with the BMDP physical file, then runs the CONTENTS and PRINT procedures on the save file:
libname mylib bmdp 'mybmdp.dat'; proc contents data=mylib.abc; run; proc print data=mylib.abc; run;
The following example uses the LIBNAME statement to associate the libref MYLIB2 with the BMDP physical file. Then it prints the data for the first save file in the physical file:
libname mylib2 bmdp 'mybmdp.dat'; proc print dat=mylib2._first_; run;
Because the Inter-University Consortium on Policy and Social Research (ICPSR) uses the OSIRIS file format for distribution of its data files, SAS provides the OSIRIS interface library engine to support ICPSR data users and to be compatible with PROC CONVERT, which is described in 'CONVERT Procedure' on page 426.
The read-only OSIRIS engine enables you to read OSIRIS data and dictionary files directly from a SAS program. These files must be stored in EBCDIC format. This means that you must have downloaded the OSIRIS files from your host computer in binary format. The following section assumes that you are familiar with the OSIRIS file terminology. [*]
To read an OSIRIS file, you must issue a LIBNAME statement that explicitly specifies you want to use the OSIRIS engine. In this case, the LIBNAME statement takes the following form:
LIBNAME libref OSIRIS ' data-filename ' DICT=' dictionary-filename ';
In this form of the LIBNAME statement, libref is a SAS libref, data-filename is the physical filename of the OSIRIS data file, and dictionary-filename is the physical filename of the OSIRIS dictionary file. The dictionary-filename argument can also be an environment variable name or a fileref. (Do not use quotation marks if it is an environment variable name or fileref.) The DICT= option must appear because the engine requires both files.
OSIRIS data files do not have member names . Therefore, you can use whatever member name you like. You can use the same OSIRIS dictionary file with different OSIRIS data files. Write a separate LIBNAME statement for each one.
The layout of an OSIRIS data dictionary is consistent across operating environments. The reason is that the OSIRIS software does not run outside the z/OS environment, but the engine is designed to accept an z/OS data dictionary on any other operating environment under which SAS runs. It is important that the OSIRIS dictionary and data files not be converted from EBCDIC to ASCII; the engine expects EBCDIC data. There is no specific file layout for the OSIRIS data file. The file layout is dictated by the contents of the OSIRIS dictionary file.
In the following example, the data file is MYOSIRIS.DAT, and the dictionary file is MYOSIRIS.DIC. The example associates the libref MYLIB with the OSIRIS files and then runs PROC CONTENTS and PROC PRINT on the data:
libname mylib osiris 'myosiris.dat' dict='myosiris.dic'; proc contents data=mylib._first_; run; proc print data=mylib._first_; run;
The SPSS interface library engine enables you to read SPSS export files directly from a SAS program. The SPSS export file must be created by using the SPSS EXPORT command. [**] The SPSS engine is a read-only engine.
To read an SPSS export file you must issue a LIBNAME statement that explicitly specifies that you want to use the SPSS engine. In this case, the LIBNAME statement takes the following form:
LIBNAME libref SPSS <' filename '>;
In this form of the LIBNAME statement, the libref argument is a SAS libref, and filename is the SPSS physical filename, including the file extension. If the libref appears also as a fileref, you can omit filename because the physical filename that is associated with the fileref is used. The SPSS native file format is not supported. Export files can originate from any operating environment.
Because SPSS files do not have internal names, you can refer to them by any member name that you like. (The example in this discussion uses _FIRST_ .)
The following example associates the libref MYLIB with the physical file MYSPSS.POR in order to run PROC CONTENTS and PROC PRINT on the save file:
libname mylib spss 'myspss..por'; proc contents data=mylib._first_; run; proc print data=mylib._first_; run;
[*] See documentation provided by the Institute for Social Research for more information.
[**] See documentation provided by SPSS Inc. for more information.