Use the OPEN and VARNUM functions to determine if a variable exists in a SAS data set. The OPEN function opens a SAS data set and returns a data set identifier. The VARNUM function returns the variable’s position in the data set. If the variable does not exist then VARNUM returns a 0.
/* Specify the data set to open in the OPEN function. Specify the */ |
/* variable to be located in the second parameter of the VARNUM */ |
/* function. If the variable does not exist, the value of check */ |
%let dsid = %sysfunc(open(test)); |
%let chk = %sysfunc(varnum(&dsid, count)); |
%let rc = %sysfunc(close(&dsid)); |
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.