全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1057 1
2019-04-09
The following SAS program is submitted:
%let sun=SHINE;
%let shine=MOON;
proc print data=weather(keep=sun shine moon);
sum &&&&sun;
run;
Which one of the following variables is summed in the resulting report?
Correct answer: c
a. sun
b. MOON
c. SHINE
d. None, an ERROR message will be written to the log.

选C,解释是When the macro processor encounters multiple ampersands preceding a macro variable
reference, it resolves two ampersands into one ampersand and re-scans the reference. In this
example, the macro processor resolves the reference &&&&sun to &&sun on the first scan. Then,
the macro processor re-scans and resolves the reference to &sun, and re-scans again, finally
resolving the reference to SHINE.

在sas里跑了一下,2,4,8,16个的时候 结果是Shine,3,5,6,9,10个&的时候结果是moon。7或者14个& 的时候结果是&moon 请问为什么只有7 是不同的呢?怎么解析的呢?

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2019-4-30 08:20:43
xiaojing20 发表于 2019-4-9 11:08
The following SAS program is submitted:
%let sun=SHINE;
%let shine=MOON;
7个&amp;<br>
&amp;&amp;&amp;&amp;&amp;&amp;&amp;sun,首先解析成&amp;&amp;&amp;shine (前六个&amp;解析成三个&amp;,第七个&amp;和sun, 也就是&amp;sun解析成shine),<br>
第二次解析成&amp;moon(前俩&amp;解析成一个&amp;,后面的&amp;shine解析成moon),<br>
但是没有对于moon的定义,所以无法进一步解析,也就是&amp;moon
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群