楼主: biouf
6407 9

[学习分享] 请教sas adv 130题里的3题 [推广有奖]

  • 0关注
  • 0粉丝

小学生

71%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
42 点
帖子
5
精华
0
在线时间
12 小时
注册时间
2012-10-26
最后登录
2014-6-20

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
74.The following SAS program is submitted:
%macro one(input);
%two
%put the value is &date;
%mend;
%macro two;
data _null_;
call symput('date', '12SEP2008');
run;
%mend;
%let date = 31DEC2006;
%one(&date)
What is the result when the %PUT statement executes?
A.A macro variable DATE with the value 12SEP2008 is retrieved from the global symbol table.
B.A macro variable DATE with the value 31DEC2006 is retrieved from the global symbol table.
C.A macro variable DATE with the value 12SEP2008 is retrieved from the local symbol table for the ONE macro.
D.A macro variable DATE with the value 12SEP2008 is retrieved from the local symbol table for the TWO macro.

Answer: A, 为什么不选D?

76.
%macro one(input);
%two
%mend;
%macro two;
data _null_;
call symputx('date', '12SEP2008', 'G');
run;
%put the value is &date;
%mend;
%let date = 31DEC2006;
%one(&date)
What is the result when the %PUT statement executes?
A.A macro variable DATE with the value 12SEP2008 is retrieved from the global symbol table.
B.A macro variable DATE with the value 12SEP2008 is retrieved from the local symbol table for the ONE macro.
C.A macro variable DATE with the value 12SEP2008 is retrieved from the local symbol table for the TWO macro.
D.A macro variable DATE with the value 31DEC2006 is retrieved from the local symbol table for the TWO
macro.

Answer: A



26. Given the SAS data setSASUSER.HIGHWAY:


SASUSER.HIGHWAY


STEERINGSEATBELTSPEED STATUSCOUNT


absentNo0-29serious 31

absentNo0-29not 1419
absentNo30-49serious 191
absentno30-49not 2004
absentno50+serious 216

The following SAS program issubmitted:

%macro highway;

proc sql noprint;
%let numgrp = 6;
select distinct status
into :group1 - :group&numgrp
from sasuser.highway;

quit;


%do i = 1 %to &numgrp;

proc print data =sasuser.highway;
where status ="&&group&i" ;
run;
%end;
%mend;
%highway

How many reports are produced?


A.0


B.2


C.5


D.6


Answer: B, 为什么不选D?



请帮忙解释一下这几道题,多谢!!


二维码

扫码加我 拉你入群

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

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

关键词:following statement Variable Statemen proc sql following result null

本帖被以下文库推荐

沙发
boe 发表于 2013-7-16 10:58:01 |只看作者 |坛友微信交流群
同求
Gorgeous girl , I love !

使用道具

藤椅
owl3207 在职认证  发表于 2013-7-16 11:17:18 |只看作者 |坛友微信交流群
26. Given the SAS data setSASUSER.HIGHWAY:
absentNo0-29      serious 31
absentNo0-29      not 1419
absentNo30-49    serious 191
absentno30-49    not 2004
absentno50+       serious 216

The following SAS program issubmitted:

%macro highway;
proc sql noprint;
%let numgrp = 6;
select distinct status------>因為dist.的關係, 原始資料裡只有兩種分類(Serious, not), 因此就已經確定只會產生2個group
into :group1 - :group&numgrp
from sasuser.highway;
quit;

%do i = 1 %to &numgrp;
proc print data =sasuser.highway;
where status ="&&group&i" ;--------------->既然只有2個group, 當然Proc print 只會產生2個囉


本文来自: 人大经济论坛 SAS专版 版,详细出处参考: https://bbs.pinggu.org/forum.php? ... e=1&from^^uid=1886358
已有 1 人评分论坛币 收起 理由
admin + 100 热心帮助其他会员

总评分: 论坛币 + 100   查看全部评分

別人不會佩服你過去的歷史
只會看到你現在的堅持.......

使用道具

板凳
biouf 发表于 2013-7-17 04:37:10 |只看作者 |坛友微信交流群
owl3207 发表于 2013-7-16 11:17
26. Given the SAS data setSASUSER.HIGHWAY:
absentNo0-29      serious 31
absentNo0-29      not 1419 ...
非常感谢高手的解析,再次谢谢!!期待74,76题的解析,呵呵:)

使用道具

报纸
109238 发表于 2013-7-17 12:04:14 |只看作者 |坛友微信交流群
When we use CALL SYMPUT inside a macro definition, it will write the macro variable values into a local symbol table, if the macro has a non empty local symbol table. If macro has an empty local symbol table, the macro variable defined inside a macro, using CALL SYMPUT routine has global scope.

src: http://www.phusewiki.org/docs/2009%20PAPERS/P015.pdf

使用道具

地板
biouf 发表于 2013-7-18 06:13:43 |只看作者 |坛友微信交流群
109238 发表于 2013-7-17 12:04
When we use CALL SYMPUT inside a macro definition, it will write the macro variable values into a lo ...
明白了!谢谢你分享的资料,再次感谢你的解析!!

使用道具

7
playmore 发表于 2013-7-18 08:53:44 |只看作者 |坛友微信交流群
109238 发表于 2013-7-17 12:04
When we use CALL SYMPUT inside a macro definition, it will write the macro variable values into a lo ...
这么tricky的设置?
当时怎么想的
没道理啊
playmore邀请您访问ChinaTeX论坛!!!进入ChinaTeX论坛

使用道具

8
kevinye123 发表于 2013-7-20 18:44:55 |只看作者 |坛友微信交流群
My Question is:
When it says "the local table is not empty", does it mean that the existing macro variable in the local table doesn't have to to be the macro variable in CALL SYMPUT?

使用道具

9
playmore 发表于 2013-7-22 08:37:46 |只看作者 |坛友微信交流群
kevinye123 发表于 2013-7-20 18:44
My Question is:
When it says "the local table is not empty", does it mean that the existing macro v ...
我觉得应该是这样
playmore邀请您访问ChinaTeX论坛!!!进入ChinaTeX论坛

使用道具

10
kevinye123 发表于 2013-7-22 13:42:19 |只看作者 |坛友微信交流群
多谢多谢

使用道具

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

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

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

GMT+8, 2024-4-28 19:49