Sample 24796: Verify the existence of a SAS data library member
Dynamically verify the existence of a SAS data set.
Note:
This function can also be used with %LET statements. See the SAS Language Reference, Dictionary under Functions and CALL Routines, EXIST for an example.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
/* Create test data set */
data work.new;
input x y z;
datalines;
1 2 3
;
/* The EXIST function returns 1 if the library member exists, or 0 */
/* if the member-name does not exist or member-type is invalid. */
/* The second parameter defaults to a member type of 'DATA' */
/* therefore it is not required in this example. To check for */
/* other library member types such as views or access descriptors */
/* please refer to the SAS Language Reference, Dictionary under */
/* Functions and CALL Routines. */
data _null_;
rc=exist('work.new','data');
if rc=1 then put 'data set exists';
else put 'data set does not exist';
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
OUTPUT to SAS log
data set exists
Dynamically verify the existence of a SAS data set.
| Type: | Sample |
| Topic: | SAS Reference ==> DATA Step SAS Reference ==> Functions ==> SAS File I/O
|
| Date Modified: | 2005-12-16 03:03:00 |
| Date Created: | 2004-09-30 14:09:15 |
Operating System and Release Information
| SAS System | Base SAS | All | 6.12 | n/a |