/*----- * group: Macro programming * purpose: Check if a data set has any rows */ %macro anyObs (data); %* data - name of data set to check if there are any observations; %* 0 if no observations found in data; %* 1 if any observations found in data; %* -1 if an error occurred; %* Richard A. DeVenezia 12/23/98; %* Note: if option NOTES is on and the data has a where clause %* that returns no rows, then there will be a note in the log %* NOTE: No observations were selected from data set .. %* There is currently no way to circumvent this. %*; %local dsid any ; %let dsid = %sysfunc (open (&DATA)); %if &dsid %then %do; %let any = %sysfunc (attrn (&dsid, ANY)); &any %let dsid = %sysfunc (close (&dsid)); %end; %else %do; -1 %end; %mend anyObs;