Previous Page | Next Page

Procedures under z/OS

CONVERT Procedure: z/OS



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

Syntax
Details
PROC CONVERT Statement
How Missing Values Are Handled
How Variable Names Are Assigned
Variable Names in BMDP Output
Variable Names in OSIRIS Output
Variable Names in SPSS Output
Example of Converting a BMDP Save File
Example of Converting an OSIRIS File
Example of Converting an SPSS File
See Also

Syntax

PROC CONVERT <options>;


Details

PROC CONVERT produces one output SAS data set but no printed output. The new SAS data set contains the same information as the input system file; exceptions are noted in How Variable Names Are Assigned.

The procedure converts system files from these software applications:

These software applications are products of other organizations. Therefore, changes might be made that make the system files incompatible with the current version of PROC CONVERT. SAS cannot be responsible for upgrading PROC CONVERT to support changes to other vendor's software applications. However, attempts to do so are made when necessary with each new version of SAS.

Information associated with each software application is given in The BMDP, SPSS, and OSIRIS Engines.


PROC CONVERT Statement

PROC CONVERT <options>;

options can be from the following list. Only one of the options that specify a system file (BMDP, OSIRIS, or SPSS) can be included. Usually only the PROC CONVERT statement is used, although data set attributes can be controlled by specifying the DROP=, KEEP=, or RENAME= data set options with the OUT= option of this procedure. See SAS Language Reference: Dictionary for more information about these data set options. You can also use LABEL and FORMAT statements following the PROC statement.

BMDP=fileref <(CODE=code-id | CONTENT= content-type)>

specifies the fileref of a BMDP save file. The first save file in the physical file is converted. If you have more than one save file in the data set, then you can use two additional options in parentheses after the libref or fileref. The CODE= option specifies the code of the save file you want, and the CONTENT= option specifies the save file's content. For example, if a file CODE=JUDGES has a content type of DATA, you can use this statement:

proc convert bmdp=bmdpfile(code=judges
   content=data);
DICT=fileref

specifies the fileref of a physical file that contains the dictionary file for the OSIRIS data set. The DICT= option is required if you use the OSIRIS= option.

FIRSTOBS=n

gives the number of the observation at which the conversion is to begin. This option enables you to skip over 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.

OSIRIS=fileref

specifies a fileref for a physical file that contains an OSIRIS file. The DICT= option is required when you use the OSIRIS= option.

OUT=SAS-data-set

names the SAS data set that are created to hold the converted data. If OUT= is omitted, SAS still creates a data set and automatically names it DATAn, just as if you omitted a data set name in a DATA statement. That is, if it is the first such data set in a job or session, then SAS names it DATA1; the second is DATA2, and so on. If you omit the OUT= option, or if you do not specify a two-level name in the OUT= option, then the converted data set is not permanently saved.

SPSS=fileref

specifies a fileref for a physical file that contains an SPSS file. The SPSS file can be in any of three formats: SPSS Release 9 (or prior), SPSS-X format (whose originating operating environment is z/OS, CMS, or VSE), or the portable file format from any operating environment that was created by using the SPSS EXPORT command.


How Missing Values Are Handled

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


How Variable Names Are Assigned

The following sections explain how names are assigned to the SAS variables that are created by the CONVERT procedure.

CAUTION:
Because some translation of variable names can occur (as indicated in the following sections), ensure that the translated names are unique.   [cautionend]

Variable Names in BMDP Output

Variable names from the BMDP save file are used in the SAS data set, except that 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 length 4. 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, when n is the response. For example, V25R1 would be the first response of the multiple response V25. If the variable after or including V1000 has 100 or more responses, then 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 whose length is greater than 200 is truncated to 200. The OSIRIS variable description becomes a SAS variable label, and OSIRIS print format information is translated to the appropriate SAS format specification.


Variable Names in SPSS Output

SPSS variable names and labels become variable names and labels without any changes. SPSS alphabetic variables become SAS character variables. 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 them. SPSS value labels are not copied.


Example of 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. The PROC CONTENTS output would be similar to the example output that is shown in NEW Save File Created from Data Set TEMP and Converted to SAS Data Set XYZ, Part 1 of 3.

filename ft04f001 'userid.bmdp.savefile';
proc convert bmdp=ft04f001 out=temp;
run;

title 'BMDP CONVERT Example';

proc contents;
run;


Example of Converting an OSIRIS File

The following statements convert an OSIRIS file and produce the temporary SAS data set TEMP, which contains the converted data. Converting an OSIRIS File shows the attributes of TEMP.

filename osiris 'userid.misc.cntl(osirdata)';
filename dict 'userid.misc.cntl(osirdict)';
proc convert osiris=osiris dict=dict out=temp;
run;

title 'OSIRIS CONVERT Example';

proc contents;
run;

Converting an OSIRIS File

                              OSIRIS CONVERT Example
                                The CONTENTS Procedure

   Data Set Name: WORK.TEMP                            Observations:         20
   Member Type:   DATA                                 Variables:            9
   Engine:        V9                                   Indexes:              0
   Created:       9:46 Monday, April 27, 2005          Observation Length:   36
   Last Modified: 9:46 Monday, April 27, 2005          Deleted Observations: 0
   Protection:                                         Compressed:           NO
   Data Set Type:                                      Sorted:               NO
   Label:

                   -----Engine/Host Dependent Information-----

         Data Set Page Size:         6144
         Number of Data Set Pages:   1
         First Data Page:            1
         Max Obs per Page:           135
         Obs in First Data Page:     20
         Number of Data Set Repairs: 0
         Physical Name:              SYS99117.T152416.RA000.USERID.R0121907
         Release Created:            8.0000B2
         Release Last Modified:      8.0000B2
         Created by:                 USERID
         Last Modified by:           USERID
         Subextents:                 1
         Total Blocks Used:          1

               -----Alphabetic List of Variables and Attributes-----

    #  Variable  Type  Len  Pos  Format  Label
    --------------------------------------------------------------------------
    1  V1        Num     4    0          INTERVIEW NUMBER         REF=   1 ID=
    2  V2        Num     4    4          INTERVIEWER NUMBER       REF=   2 ID=
    3  V3        Num     4    8          PRIMARY SAMPLING UNIT    REF=   3 ID=
    4  V4        Num     4   12          REGION                   REF=   4 ID=
    5  V5        Num     4   16          CHUNK AND SEGMENT        REF=   5 ID=
    6  V6        Num     4   20          LANGUAGE OF INTERVIEW    REF=   6 ID=
    7  V7        Num     4   24          LANGUAGE OF INTERVIEW    REF=1621 ID=
    8  V9        Num     4   28          LNGTH OF INTERVIEW       REF=1620 ID=
    9  V9        Num     4   32  12.4    WEIGHT                   REF=1700 ID=

Example of Converting an SPSS File

The following statements convert an SPSS Release 9 file and produce the temporary SAS data set TEMP, which contains the converted data. The output generated by PROC CONTENTS is similar in format to Converting an OSIRIS File.

filename spss 'userid.spssfile.num1';
proc convert spss=spss out=temp;
run;

title 'SPSSR9 CONVERT Example';

proc contents;
run;


See Also

Previous Page | Next Page | Top of Page