REPLACE= Data Set Option

Specifies whether a new SAS data set that contains data can overwrite an existing data set that has the same name.

Valid in: DATA step and PROC steps
Category: Data Set Control
Restrictions: Use with output data sets only.
This option is valid only when creating a SAS data set.
Note: When you use the OUT2= PermanentLibrary._ALL_ option within PROC CONTENTS or PROC DATASETS with the CONTENTS statement, you must also set the REPLACE=YES data set option or the REPLACE system option.

Syntax

REPLACE=NO | YES

Syntax Description

NO

specifies that a new data set with a given name does not replace an existing data set with the same name.

YES

specifies that a new data set with a given name replaces an existing data set with the same name.

Details

  • The REPLACE= data set option overrides the REPLACE system option for the individual data set.
  • The REPLACE system option only applies to permanent SAS data sets.
Use REPLACE=YES and REPEMPTY=NO for the convenience of replacing existing data sets with new ones that contain data.

Example

Using the REPLACE= data set option in this DATA statement prevents SAS from replacing a permanent SAS data set named ONE in a library referenced by MYLIB:
 data mylib.one(replace=no);
SAS writes a message to the log that the file has not been replaced.

See Also

System Options:
REPLACE System Option in SAS System Options: Reference