Is there some mechanism that can determine if a macro was defined with certain argument list ?
MacSignatureMatch(<macro-name>, <argument-list>)
would return 0 for no, and 1 for yes
Example use:
Suppose we have two macros defined as
%macro xyzzy (x, y, z, foo=, bar=) ;
...
%mend xyzzy ; %macro snafu (x, y, z, foo=, bar=) ;
...
%mend snafu ;
And they are available for a program to use via a parameter specification
%let wedge_postmacro = SNAFU ;
The program will code generate the macro call based on control data supplied
proc import dbms=xlsx datafile=control replace out=control ;
sheet = 'dispatches' ;
run ; * validate structure and contents of control... ;
Further suppose the control data has a column [program] for which after including the program, the specified macro needs to be invoked, but only if the macro call will not cause a macro invocation error.
data _null_ ;
set control_validated ;
call execute ('%nrstr(%include) ' || quote(trim(program)) || ' ;') ;
parameter = 'wedge_postmacro' ;
if symexist(parameter) then do ;
macro = symget(parameter) ;
if not missing (macro) then do ;
exists = resolve ('%sysmacexist(' || trim(macro) || ')') ; if exists then do ; *** ; *** ; Can signature be deteremined ? *** ; For sake of argument suppose there is an FCMP function named MacSignatureMatch() that can do so ; *** ; if MacSignatureMatch(macro, 'x, y, z, foo=, bar=') then do ; call execute ('%nrstr(' || trim(macro) || ')' || '( ' || cats(controlX) || ', ' || cats(controlY) || ', ' || cats(controlZ) || ', foo=' || cats(controlFoo) || ', bar=' || cats(controlBar) end ; end ; end ; end ; run ;
The wedge macro itself may cause warnings or errors if coded incorrectly for the wedge task at hand.
... View more