Chapter Contents

Previous

Next
EXIST

EXIST



Verifies the existence of a member of a SAS data library

Category: SAS Table


Syntax
Details
Examples
Example 1: Verifying the Existence of a SAS Table
Example 2: Verifying the Existence of a SAS Data View
Example 3: Determining if a Data Set Generation Exists
See Also

Syntax

rc=EXIST(member-name<,member-type<,generation>> );

rc
contains the return code for the operation:
1 The library member exists.
0 Either member-name does not exist or member-type is invalid.

Type: Numeric

member-name
is the name of the SAS data library member.

Type: Character

member-type
is the type of SAS data library member:

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

'CATALOG'
indicates a SAS catalog or catalog entry.

'DATA'
indicates a SAS data file. (This is the default.)

'VIEW'
indicates a SAS data view.

Type: Character

generation
is the generation number of the SAS table whose existence you are checking. If member-type is not DATA, generation is ignored.

Type: Numeric


Details

If member-name is not specified, EXIST verifies the existence of the member specified by the system variable _LAST_. If member-type contains an invalid value, EXIST returns the value 0.


Examples

Example 1: Verifying the Existence of a SAS Table

Call the FSEDIT function only if the SAS table specified in the variable TABLENAME exists. If the table does not exist, display a message on the message line.

if (exist(tablename)) then call fsedit(tablename);
else _msg_='Table '||tablename||' does not exist.';

Example 2: Verifying the Existence of a SAS Data View

Verify the existence of the SAS table view TEST.MYVIEW:

rc=exist('test.myview','view');

Example 3: Determining if a Data Set Generation Exists

Determine if the third generation of the data set work.one exists:

rc=exist('work.one','data',3);

See Also

CEXIST

FEXIST

FILEEXIST


Chapter Contents

Previous

Next

Top of Page

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