Previous Page | Next Page

Processing VSAM Data Sets in SAS Programs

Combined Operations

You might want to perform more than one operation in one DATA step. (For example, perhaps you want to read some records, update other records, and add new records all in one DATA step.) Regardless of the number of different operations, only one pair of INFILE and FILE statements for the data set is needed during the DATA step. Specify all the options you might need for processing the data set in its INFILE statement.

In a DATA step that combines operations, SAS determines whether you want to update existing records or add new records.

When you do not have an INPUT statement that is associated with the INFILE statement (because you are adding records without reading from the data set), SAS assumes that the data in the PUT statement is to be added as a new record. If you are processing a KSDS, you must specify a new primary key in the PUT statement. If you are processing an RRDS, you must specify an empty relative-record slot with the RRN= option in the INFILE statement.

When you do have an INPUT statement that is associated with the INFILE statement (that is, you are reading from the data set before writing), SAS assumes that the data in the PUT statement is to update the record that you have just read with the INPUT statement unless you have changed one of the following:

Previous Page | Next Page | Top of Page