SAS中文论坛

标题: 一个Macro问题 [打印本页]

作者: shiyiming    时间: 2011-1-12 19:57
标题: 一个Macro问题
The following SAS program is submitted:
%let a = cat;
%macro animal(a = frog);
%let a = bird;
%mend;
%animal(a = pig)
%put a is &a;
What is written to the SAS log?
请回答并解释
作者: shiyiming    时间: 2012-7-13 21:51
标题: Re: 一个Macro问题
The local symbol table is deleted when the macro finishes execution.That is,the local symbol table exists only while the macro executes.
在这个宏定义中产生的A的值是存在于symbol表中的,而后面的引用是在global表中产生的A值,故其值为cat




欢迎光临 SAS中文论坛 (http://www.mysas.net/forum/) Powered by Discuz! X3.2