请选择 进入手机版 | 继续访问电脑版
楼主: 甲基橙crads
1190 2

[学习分享] 求教一个sas adv130题里面的第80题 [推广有奖]

  • 0关注
  • 3粉丝

博士生

24%

还不是VIP/贵宾

-

威望
0
论坛币
5797 个
通用积分
16.1868
学术水平
4 点
热心指数
11 点
信用等级
0 点
经验
3026 点
帖子
102
精华
0
在线时间
315 小时
注册时间
2016-2-23
最后登录
2023-2-14

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
  1. %let rc = Begin;
  2. %macro test;
  3. data out;
  4. set sashelp.prdsale nobs = totalobs;
  5. if totalobs > 10 then do;
  6. %let rc = high;
  7. end;
  8. else do;
  9. %let rc = low;
  10. end;
  11. run;
  12. %mend;
  13. %let rc = Before Execution;
  14. %test  
复制代码
以上代码中,运行以后RC值为什么是low而不是high,我在sas里面跑出来的结果依然是low,不知道原因,求教
原题目是:
The data set SASHELP.PRDSALE has 50 observations. What is the value of the variable RC when the macro finishes execution?
A.low
B.high
C.Begin
D.Before Execution


二维码

扫码加我 拉你入群

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

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

关键词:observations observation EXECUTION Variable observat

回帖推荐

xiaopingN 发表于2楼  查看完整内容

Because the %LET statements are always processed by the macro processor before the DATA step is executed, the value is always whatever the last %LET statement assigns.中文意思是%LET statements给宏赋值,因为 宏赋值总是比DATA步优先, 所以DATA步里的if then 对%LET statements 赋值没有处理能力, 得到的 宏值 总是最后%LET statement的赋值。这里最后的%LET statements是%let rc = low;所以得到的结果就是low。
xiaopingN 发表于 2019-2-27 23:07:38 |显示全部楼层 |坛友微信交流群
Because the %LET statements are always processed by the macro processor before the DATA step is executed, the value is always whatever the last %LET statement assigns.中文意思是%LET statements给宏赋值,因为 宏赋值总是比DATA步优先, 所以DATA步里的if then 对%LET statements 赋值没有处理能力, 得到的 宏值 总是最后%LET statement的赋值。这里最后的%LET statements是%let rc = low;所以得到的结果就是low。
已有 1 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
admin_kefu + 30 + 3 + 3 + 3 热心帮助其他会员

总评分: 论坛币 + 30  学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

使用道具

xiaopingN 发表于 2019-2-27 23:07
Because the %LET statements are always processed by the macro processor before the DATA step is exec ...
感谢大神

使用道具

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

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

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

GMT+8, 2024-4-19 05:08