- %macro defined (mvar);
- %local dsid rc scope;
- /** Open the vmacro view which contains info about macor vars **/
- %let dsid=%sysfunc(open(sashelp.vmacro (where=(name="%upcase(&mvar)"))));
- /** Fetch a record into the pdv if it exists **/
- %let rc=%sysfunc(fetch(&dsid));
- /** Return varnum 1, the scope **/
- %let scope = %sysfunc(getvarc(&dsid,1));
- /** Close the view **/
- %let rc=%sysfunc(close(&dsid));
- %if &scope = GLOBAL %then 1; %else 0;
- %mend;
作用就是检查某个宏变量是否存在,当存在时,运行%put %defined(a);后可以得到1,否则得到0。
请问是哪条语句可以赋给宏一个返回值?
谢谢!