楼主: xiaojing20
922 1

[学习分享] SAS Adv 50题的第17题 多个&&的问题 [推广有奖]

  • 0关注
  • 0粉丝

VIP1+

小学生

78%

还不是VIP/贵宾

-

威望
0
论坛币
1699 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
60 点
帖子
2
精华
0
在线时间
22 小时
注册时间
2019-2-21
最后登录
2019-8-21

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
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 是不同的呢?怎么解析的呢?

二维码

扫码加我 拉你入群

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

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

关键词:encounters Reference Processor following Resolving

沙发
小沐君 发表于 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
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
xiaojing20 + 5 + 5 + 5 精彩帖子

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-27 04:28