全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
6734 9
2013-07-16
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?



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


二维码

扫码加我 拉你入群

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

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

全部回复
2013-7-16 10:58:01
同求
二维码

扫码加我 拉你入群

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

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

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
二维码

扫码加我 拉你入群

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

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

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题的解析,呵呵:)
二维码

扫码加我 拉你入群

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

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

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
二维码

扫码加我 拉你入群

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

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

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 ...
明白了!谢谢你分享的资料,再次感谢你的解析!!
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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