Hi:
I agree with Vince. This is more of a BASE SAS and SAS MACRO question. There is no "automatic" global macro variable that tell whether no records were found in a dataset. However, you could use a technique similar to the one shown in the this previous forum posting:
http://support.sas.com/forums/thread.jspa?messageID=6659ᨃ
Although the initial question was about IF statements, there is an example of finding out the number of observations in a dataset and issuing an error message if no observations are found.
Other relevant posts are these:
http://support.sas.com/forums/thread.jspa?messageID=8828≼
http://support.sas.com/forums/thread.jspa?messageID=33691莛
http://support.sas.com/forums/thread.jspa?messageID=16219㽛
http://support.sas.com/forums/thread.jspa?messageID=8249‹
Most of these previous postings show the use of "dictionary" tables to determine the number of observations in a dataset. Several previous forum postings have discussed the use of DICTIONARY.TABLES and other types of DICTIONARY files in order to access information about SAS datasets. With PROC SQL, you can use the INTO clause in order to create macro variables from the results of a particular query. Some of the postings are:
http://support.sas.com/forums/thread.jspa?messageID=14535㣇
http://support.sas.com/forums/thread.jspa?messageID=9171⏓
http://support.sas.com/forums/thread.jspa?messageID=11252⯴
Here are some user group papers that outline what the "dictionary" tables do:
http://www2.sas.com/proceedings/sugi30/070-30.pdf
http://www2.sas.com/proceedings/sugi29/237-29.pdf
http://www.codecraftersinc.com/pdf/DictionaryTablesRefCard.pdf
http://www.lexjansen.com/pharmasug/2006/tutorials/tu03.pdf
http://www.qsl.net/kd6ttl/sas/sqlutilov.pdf
Before you roll the necessary logic into a stored process, however, I recommend that you understand how the macro variables will work outside of a stored process, by creating some test programs, in order to aid in debugging your changed program (before you modify your stored process code).
cynthia