如何定義一個宏變量,該變量包含對尚未定義的其他宏變量的引用而不生成警告?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.
是否有某種方式來避免寫警告日誌?