The DATASETS Procedure |
Featured in: | Manipulating SAS Files |
DELETE SAS-file-1 <...SAS-file-n>
</ <ALTER=alter-password> <GENNUM=ALL|HIST|REVERT|integer> <MEMTYPE=mtype>>; |
Required Arguments |
specifies one or more SAS files that you want to delete. You can also use a numbered range list or colon list. For more information, see Data Set Lists.
Options |
provides the alter password for any alter-protected SAS files that you want to delete. You can use the option either in parentheses after the name of each SAS file or after a forward slash.
See also: | Using Passwords with the DATASETS Procedure |
restricts processing for generation data sets. You can use the option either in parentheses after the name of each SAS file or after a forward slash. The following is a list of valid values:
refers to the base version and all historical versions in a generation group.
refers to all historical versions, but excludes the base version in a generation group.
deletes the base version and changes the most current historical version, if it exists, to the base version.
is a number that references a specific version from a generation group. Specifying a positive number is an absolute reference to a specific generation number that is appended to a data set's name; that is, gennum=2 specifies MYDATA#002. Specifying a negative number is a relative reference to a historical version in relation to the base version, from the youngest to the oldest; that is, gennum=-1 refers to the youngest historical version.
See also: |
|
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.
Aliases: | MT=, MTYPE= |
Default: | DATA |
See also: | Restricting Member Types for Processing |
Featured in: | Manipulating SAS Files |
Details |
SAS immediately deletes SAS files when the RUN group executes. You do not have an opportunity to verify the delete operation before it begins.
If you attempt to delete a SAS file that does not exist in the procedure input library, PROC DATASETS issues a message and continues processing. If NOWARN is used, no message is issued.
When you use the DELETE statement to delete a data set that has indexes associated with it, the statement also deletes the indexes.
You cannot use the DELETE statement to delete a data file that has a foreign key integrity constraint or a primary key with foreign key references. For data files that have foreign keys, you must remove the foreign keys before you delete the data file. For data files that have primary keys with foreign key references, you must remove the foreign keys that reference the primary key before you delete the data file.
Working with Generation Groups |
When you are working with generation groups, you can use the DELETE statement to delete the following versions:
delete the base version and all historical versions
delete the base version and rename the youngest historical version to the base version
delete an absolute version
delete a relative version
delete all historical versions and leave the base version
The following statements delete the base version and all historical versions where the data set name is A:
proc datasets; delete A(gennum=all); proc datasets; delete A / gennum=all; proc datasets gennum=all; delete A;
The following statements delete the base version and all historical versions where the data set name begins with the letter A:
proc datasets; delete A:(gennum=all); proc datasets; delete A: / gennum=all; proc datasets gennum=all; delete A:;
The following statements delete the base version and rename the youngest historical version to the base version, where the data set name is A:
proc datasets; delete A(gennum=revert); proc datasets; delete A / gennum=revert; proc datasets gennum=revert; delete A;
The following statements delete the base version and rename the youngest historical version to the base version, where the data set name begins with the letter A:
proc datasets; delete A:(gennum=revert); proc datasets; delete A: / gennum=revert; proc datasets gennum=revert; delete A:;
The following statements use an absolute number to delete the first historical version:
proc datasets; delete A(gennum=1); proc datasets; delete A / gennum=1; proc datasets gennum=1; delete A;
The following statements delete a specific historical version, where the data set name begins with the letter A:
proc datasets; delete A:(gennum=1); proc datasets; delete A: / gennum=1; proc datasets gennum=1; delete A:;
The following statements use a relative number to delete the youngest historical version, where the data set name is A:
proc datasets; delete A(gennum=-1); proc datasets; delete A / gennum=-1; proc datasets gennum=-1; delete A;
The following statements use a relative number to delete the youngest historical version, where the data set name begins with the letter A:
proc datasets; delete A:(gennum=-1); proc datasets; delete A: / gennum=-1; proc datasets gennum=-1; delete A:;
The following statements delete all historical versions and leave the base version, where the data set name is A:
proc datasets; delete A(gennum=hist); proc datasets; delete A / gennum=hist; proc datasets gennum=hist; delete A;
The following statements delete all historical versions and leave the base version, where the data set name begins with the letter A:
proc datasets; delete A:(gennum=hist); proc datasets; delete A: / gennum=hist; proc datasets gennum=hist; delete A:;
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.