我看了半天,说说我的理解。
第一段代码中,定义mcro时候,参数中已经定义了一个local 的 Mv,
所以,mcro中的 %let Mv = clothes;更新的是mcaro 中的 local 的Mv
这个理解 来自于下面的第一步。
你可以试试%put 放到 macro中,就会发现有两个Mv 变量,一个global,一个local。
第二段代码中,mcro 中没有定义 local 的 Mv,只是更新 Mv,所以,值被更新了。
以下是我的依据,注意加粗部分,
Suppose the macro processor receives a %LET statement during a macro call, as follows:
%let macvar=value;The macro processor processes the following steps:
1.The macro processor checks to see whether the macro variable macvar already exists in the local symbol table. If so, the macro processor updates macvar in the local symbol table with the value value. If macvar does not exist in the local table, the macro processor goes on to step 2.
2.The macro processor checks to see whether the macro variable macvar already exists in the global symbol table. If so, the macro processor updates macvar in the global symbol table with the value value. If macvar does not exist in the global symbol table, the macro processor goes on to step 3.
3.The macro processor creates a macro variable named macvar in the local symbol table and assigns a value of value to it.
|