CONVERT Procedure: UNIX

Converts BMDP and OSIRIS system files and SPSS export files to SAS data sets.
UNIX specifics: all

Syntax

PROC CONVERT product-specification <option-list> ;

Required Argument

product-specification
Product-specification can be one of the following:
BMDP=fileref <(CODE=code CONTENT=content-type)>
converts the first member of a BMDP save file created under UNIX (AIX) into a SAS data set. Here is an example:
filename save '/usr/mydir/bmdp.dat';
proc convert bmdp=save;
run;
If you have more than one save file in the BMDP file referenced by the fileref argument, you can use two options in parentheses after fileref. The CODE= option specifies the code of the save file that you want, and the CONTENT= option specifies the content of the save file. For example, if a file with code=judges has a content of DATA, you can use the following statements:
filename save '/usr/mydir/bmdp.dat';
proc convert bmdp=save(code=judges 
                       content=data);
run;
OSIRIS=fileref|libref
specifies a fileref or libref for the OSIRIS file to be converted into a SAS data set. You must also include the DICT= option.
SPSS=fileref|libref
specifies a fileref or libref for the SPSS export file that is to be converted into a SAS data set. The SPSS file must be created by using the SPSS EXPORT command, but it can be from any operating environment.

Optional Argument

option-list
Option-list can be one of the following:
DICT=fileref|libref
specifies a fileref or libref of the dictionary file for the OSIRIS file. DICT= is valid only when used with the OSIRIS product specification.
FIRSTOBS=n
gives the number of the observation where the conversion is to begin, so that you can skip observations at the beginning of the BMDP, OSIRIS, or SPSS file.
OBS=n
specifies the number of the last observation to be converted. This option enables you to exclude observations at the end of the file.
OUT=SAS-data-set
names the SAS data set that will hold the converted data. If OUT= is omitted, SAS still creates a Work data set and automatically names it DATAn, just as if you had omitted a data set name in a DATA statement. For more information, see For more information, see Introduction to SAS Files, Libraries, and Engines in UNIX Environments.

Details

Converting System Files

The CONVERT procedure converts BMDP and OSIRIS system files, and SPSS export files to SAS data sets. The procedure is supplied for compatibility. The procedure invokes the appropriate engine to convert files.
PROC CONVERT produces one output data set, but no printed output. The new data set contains the same information as the input system file. Exceptions are noted in How Missing Values Are Handled.
The procedure converts system files from these products:
  • BMDP saves files up to and including the most recent release of BMDP (available for AIX, HP-UX, and Solaris only).
  • OSIRIS saves files through and including OSIRIS IV. (Hierarchical file structures are not supported.)
Because the BMDP, OSIRIS, and SPSS products are maintained by other organizations, changes might be made that make new files incompatible with the current version of PROC CONVERT. SAS upgrades PROC CONVERT to support changes to these products only when a new version of SAS is released.

How Missing Values Are Handled

If a numeric value in the output data set has no value or has a system missing value, PROC CONVERT assigns it a missing value.

How Variable Names Are Assigned

The following sections explain how names are assigned to the SAS variables created by the CONVERT procedure.
CAUTION:
Make sure that the translated names will be unique.
Variable names are translated as indicated in the following sections.

Variable Names in BMDP Output

Variable names from the BMDP save file are used in the SAS data set, but nontrailing blanks and all special characters are converted to underscores in the SAS variable names. The subscript in BMDP variable names, such as x(1), becomes part of the SAS variable name with the parentheses omitted: X1. Alphabetic BMDP variables become SAS character variables of corresponding length. Category records from BMDP are not accepted.

Variable Names in OSIRIS Output

For single-response variables, the V1 through V9999 name becomes the SAS variable name. For multiple-response variables, the suffix Rn is added to the variable name where n is the response. For example, V25R1 would be the first response of the multiple-response V25. If the variable after V1000 has 100 or more responses, responses above 99 are eliminated. Numeric variables that OSIRIS stores in character, fixed-point binary, or floating-point binary mode become SAS numeric variables. Alphabetic variables become SAS character variables; any alphabetic variable of length greater than 200 is truncated to 200. The OSIRIS variable description becomes a SAS variable label, and OSIRIS print format information becomes a SAS format.

Variable Names in SPSS Output

SPSS variable names and variable labels become variable names and labels without change. SPSS alphabetic variables become SAS character variables of the same length. SPSS blank values are converted to SAS missing values. SPSS print formats become SAS formats, and the SPSS default precision of no decimal places becomes part of the variables' formats. The SPSS DOCUMENT data is copied so that the CONTENTS procedure can display it. SPSS value labels are not copied.

Comparison with Interface Library Engines

The CONVERT procedure is closely related to the interface library engines BMDP, OSIRIS, and SPSS. (In fact, the CONVERT procedure uses these engines.) For example, the following two sections of code provide identical results:
filename myfile 'mybmdp.dat';
proc convert bmdp=myfile out=temp;
run;

libname myfile bmdp 'mybmdp.dat';
data temp;
   set myfile._first_;
run;
However, the BMDP, OSIRIS, and SPSS engines provide more extensive capability than PROC CONVERT. For example, PROC CONVERT converts only the first BMDP member in a save file. The BMDP engine, in conjunction with the COPY procedure, copies all members.

Examples

Example 1: Converting a BMDP Save File

The following statements convert a BMDP save file and produce the temporary SAS data set temp, which contains the converted data:
filename bmdpfile 'bmdp.savefile';
proc convert bmdp=bmdpfile out=temp;
run;

Example 2: Converting an OSIRIS File

The following statements convert an OSIRIS file and produce the temporary SAS data set temp, which contains the converted data:
filename osirfile 'osirdata';
filename dictfile 'osirdict';
proc convert osiris=osirfile dict=dictfile 
             out=temp;
run;

Example 3: Converting an SPSS File

The following statements convert an SPSS file and produce the temporary SAS data set temp, which contains the converted data:
filename spssfile 'spssfile.num1';
proc convert spss=spssfile out=temp;
run;