DATASETS Procedure

SAVE Statement

Deletes all the SAS files in a library except the ones listed in the SAVE statement.
Saving SAS Files from Deletion

Syntax

Required Argument

SAS-file-1 <...SAS-file-n>
specifies one or more SAS files that you do not want to delete from the SAS library.
Note: If a SAS file has an ALTER= password assigned, it must be specified in order to delete the SAS file.

Optional Argument

MEMTYPE=mtype
restricts processing to one member type. You can use the option either in parentheses after the name of each SAS file or after a forward slash.
Alias:MTYPE= and MT=
Default:If you do not specify the MEMTYPE= option in the PROC DATASETS statement or in the SAVE statement, the default is MEMTYPE=ALL.

Details

If one of the SAS files in SAS-file does not exist in the procedure input library, PROC DATASETS stops processing the RUN group containing the SAVE statement and issues an error message. To override this behavior, specify the NOWARN option in the PROC DATASETS statement.
When the SAVE statement deletes SAS data sets, it also deletes any indexes associated with those data sets. (If the SAS data set that is to be deleted has an ALTER= password assigned to it, the ALTER= password must be specified in order to delete the SAS data set.)
CAUTION:
SAS immediately deletes libraries and library members when you submit a RUN group.
You are not asked to verify the delete operation before it begins. Because the SAVE statement deletes many SAS files in one operation, make sure that you understand how the MEMTYPE= option affects which types of SAS files are saved and which types are deleted.
When you use the SAVE statement with generation groups, the SAVE statement treats the base version and all historical versions as a unit. You cannot save a specific version.