我想输入一个表列表作为宏参数。
宏代码:
%MACRO Marco_Name ( Table_Name ) ;
PROC SQL;
execute (
select (owner ||'.'||table_name) as table_name from dba_tables
where table_name in (&Table_Name.)
)
QUIT;
%MEND Marco_Name ;
当我用例如:
调用宏时%Marco_Name ( Table_Name = 'table1', 'table2, 'table3')
我想将代码解析为:
select (owner ||'.'||table_name) as table_name from dba_tables
where table_name in ('table1', 'table2, 'table3')
答案 0 :(得分:1)
欢迎来到精彩的marco编程世界。
%STR
宏函数用于包含逗号的值,否则这些逗号会在作为参数传递时混淆宏处理器。
按如下方式调用宏:
%MyMacro ( Table_Name = %str ( 'table1', 'table2, 'table3' ) )