Accessing BMDP Files

Overview of BMDP Files

The BMDP engine can read only BMDP save files that were created on the same operating environment. For example, the BMDP engine under z/OS cannot read BMDP files that were created under the UNIX operating environment.

Assigning a Libref to a BMDP File

In order to access a BMDP file, you must use the LIBNAME statement or LIBNAME function to assign a libref to the file.
You do not need to use a LIBNAME statement or function before running PROC CONVERT if you are using PROC CONVERT to convert a BMDP file to a SAS data file. For more information, see CONVERT Procedure: z/OS.
Note that the LIBNAME statement has no options for the BMDP engine.
If you previously used a TSO ALLOC command or a JCL DD statement to assign a ddname to the BMDP file, then you can omit the physical-filename (a physical filename in the z/OS operating environment) in the LIBNAME statement or LIBNAME function and use the ddname as the libref. See Accessing BMDP Files.
For information about the LIBNAME statement, see LIBNAME Statement: z/OS. For information about the LIBNAME function, see “LIBNAME Function” in the SAS Functions and CALL Routines: Reference.

Referencing BMDP Files

Because there can be multiple save files in a single physical BMDP file, you use the value of the BMDP CODE= argument as the name of the SAS data file. For example, if the BMDP save file contains CODE=ABC and CODE=DEF, and if the libref is XXX, you reference the files as XXX.ABC and XXX.DEF. All BMDP CONTENT types are treated the same, so even if file DEF has CONTENT=CORR under BMDP, SAS treats it as CONTENT=DATA.
In your SAS program, if you want to access the first BMDP save file in the physical file, or if there is only one save file, then you can refer to the file as _FIRST_. This approach is convenient if you do not know the BMDP CODE= value.

Examples of Accessing BMDP Files

Suppose the physical file MY.BMDP.FILE contains the save file ABC. The following statements assign a libref to the data set and then run PROC CONTENTS and PROC PRINT on the BMDP file:
libname xxx bmdp 'my.bmdp.file';
proc contents data=xxx.abc;
proc print data=xxx.abc;
run;
In the next example, the TSO ALLOC command associates a ddname with the name of the physical file that comprises the BMDP physical-filename. The physical filename is omitted in the LIBNAME statement and LIBNAME function, because the libref that is used is the same as the ddname in the TSO statement. The PROC PRINT statement prints the data for the first save file in the physical file.
tso alloc f(xxx) da('my.bmdp.file') shr reu;
libname xxx bmdp;
proc print data=xxx._first_;
run;