Chapter Contents

Previous

Next
DELETE

DELETE



Deletes a member of a SAS data library or an external file or directory

Category: Utility


Syntax
Details
Examples
Example 1: Deleting Tables and Catalog Entries
Example 2: Deleting Files
Example 3: Deleting Data Set Generations
See Also

Syntax

sysrc=DELETE(name<,type,<,password<,generation>>>);

sysrc
contains the return code for the operation:
0 successful
[ne]0 not successful

Type: Numeric

name
is the name of the member of the SAS data library or the physical pathname of an external file or directory. If a one-level name is specified for a SAS data library member, the library is assumed to be USER.

Type: Character

type
specifies the type of element to delete:

'ACCESS'
an access descriptor that was created using SAS/ACCESS software.

'CATALOG'
a SAS catalog or catalog entry. If a one- or two-level name is specified, the catalog is deleted. If a four-level name is specified, the entry is deleted.

'DATA'
a SAS table. (This is the default.)

'VIEW'
a SAS table view.

'FILE'
an external file or directory.

Type: Character

password
is the password that is assigned to the SAS table when type is DATA.

Type: Character

generation
is the generation number of the SAS table that is being deleted.

Type: Numeric


Details

DELETE attempts to delete the specified member and returns a value indicating whether the operation was successful. You can use DELETE to delete files or empty directories that are external to a SAS session, as well as members of a SAS data library.


Examples

Example 1: Deleting Tables and Catalog Entries

Delete the SAS table LIB1.MYDATA and the SAS catalog entry LIB2.CAT1.MYPROG.PROGRAM:

rc=delete('lib1.mydata');
rc=delete('lib2.cat1.myprog.program','catalog');

When deleting generation tables, if you delete the current (base) table without specifying the generation parameter, all tables in the generation group are deleted. For example:

rc=delete('one');
/* Deletes all tables in the generation group named 'one'*/
If you specify the current (base) table using the generation parameter, only that table is deleted. The youngest historical table becomes the new base. For example:
rc=delete('one','data',",0); 
/* Deletes only the table work.one (relative generation number=0) */

Example 2: Deleting Files

Delete an external file:

In UNIX:

/* delete a file in a different directory */
rc=delete('/local/u/abcdef/testfile','file');
In Windows:
/* delete a file in a different directory */
rc=delete('D:\testfile','file');

Example 3: Deleting Data Set Generations

Delete the third generation of a data set:

   /* delete the third generation of the data set `work.one' */
rc=delete('work.one','data',",3);

See Also

NEW


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.