如何定义一个宏变量,该变量包含对尚未定义的其他宏变量的引用而不生成警告?SAS - 定义包含未定义宏变量的宏变量而不会产生警告
考虑一个为不同变量生成类似图的程序。根据变量的不同,每个图形的标签都会改变。由于除了特定的分析变量外,所有图形都有相似的标签,所以将标签放在程序的顶部以便于修改是很有意义的。问题是,在程序中的那一点,变量名称还没有被定义。
例如:
/*Top of program*/
%let label = This &thing gets defined later.;
/* ... */
/*Later in program*/
%let thing = macro variable;
%put &=label;
这产生所需的输出:
LABEL=This macro variable gets defined later.
但它也产生在日志中的警告:
WARNING: Apparent symbolic reference THING not resolved.
如果我把一个%nrstr
周围&thing
,那么形式label
是正确的(即。 LABEL=This &thing gets defined later.
)但是,&thing
在定义后不再解析。
/*Top of program*/
%let label = This %nrstr(&thing) gets defined later.;
%put &=label;
/* ... */
/*Later in program*/
%let thing = macro variable;
%put &=label;
此输出:
LABEL=This &thing gets defined later.
LABEL=This &thing gets defined later.
是否有某种方式来避免写警告日志?