DELETE Statement
Deletes SAS files from a SAS
data library.
DELETESAS-file(s)
</ <ALTER=alter-password>
<GENNUM=ALL|HIST|REVERT|integer>
<MEMTYPE=mtype>>;
|
- SAS-file(s)
- specifies one or more SAS files that you want to delete.
- ALTER=alter-password
- provides the alter password for any alter-protected SAS
files that you want to delete. You can use the ALTER= option in parentheses
after the name of each SAS file or after a forward slash.
- GENNUM=ALL|HIST|REVERT|integer
- restricts processing to the specified generation files.
Valid values for GENNUM= are
- ALL
- refers to the base name and all generations.
- HIST
- refers to all generations (excludes the base name).
- REVERT
- refers to deleting the base name and changing the most current
generation file, if it exists, to the base name.
- postive integer
- refers to an explicit generation file.
- negative integer
- refers to a relative generation file.
- MEMTYPE=mtype
- restricts processing to one member type (mtype).
- The SAS System 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.
- 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.
When
you are working with generation groups, you can use the DELETE statement to
- delete the base name and all generations
- delete the base name and
rename the youngest generation to the
base name
- delete a specific generation
- delete a relative generation
- delete all generations and leave the base
name.
- The following statements delete the base name and all generations
where the base 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 name and all generations
where the base 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 name and rename
the youngest
generation to the base name, where the base 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 name and rename the youngest
generation to the base name, where the base 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 delete the first generation that uses
an absolute number:
proc datasets;
delete A(gennum=1);
proc datasets;
delete A / gennum=1;
proc datasets gennum=1;
delete A;
- The following statements delete a specific generation, where the
base 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 the youngest version, where the
base name is A, using a relative number:
proc datasets;
delete A(gennum=-1);
proc datasets;
delete A / gennum=-1;
proc datasets gennum=-1;
delete A;
- The following statements delete a relative generation, where the
base 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 generations and leave the
base name, where the base 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 generations and leave the
base name, where the base 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 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.