SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 1386|回复: 0
打印 上一主题 下一主题

跟crakman做sas base认证试题(54)

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2010-11-13 11:37:32 | 只看该作者

跟crakman做sas base认证试题(54)

From crackman's blog on Baidu


               
                <p><font size="4">54.Consider the following data step:<br>
<br>
data WORK.TEST;<br>
&nbsp;&nbsp;&nbsp;  set SASHELP.CLASS(obs=5);<br>
&nbsp;&nbsp;&nbsp;  retain City 'Beverly Hills';<br>
&nbsp;&nbsp;&nbsp;  State='California'; <br>
run; <br>
<br>
The computed variables City and State have their values assigned using two different methods, a RETAIN statement and an Assignment statement. Which statement regarding this program is true?</font></p>
<p><br>
<font size="4">&nbsp;&nbsp;&nbsp;  A. The RETAIN statement is fine, but the value of City will be truncated to 8<br>
bytes as the LENGTH statement has been omitted.<br>
&nbsp;&nbsp;&nbsp;&nbsp;  B. Both the RETAIN and assignment statement are being used to initialize new<br>
variables and are equally efficient. Method used is a matter of programmer preference.<br>
&nbsp;&nbsp;&nbsp;&nbsp;  C. The assignment statement is fine, but the value of City will be truncated<br>
to 8 bytes as the LENGTH statement has been omitted. <br>
&nbsp;&nbsp;&nbsp;&nbsp;  D. City's value will be assigned one time, State's value 5 times.</font></p>
<p><font size="4">Answer: D</font></p>
<p><font size="4">本文属于博客:</font><a href="http://hi.baidu.com/crack_man/home"><font size="4"><!-- m --><a class="postlink" href="http://hi.baidu.com/crack_man/home">http://hi.baidu.com/crack_man/home</a><!-- m --></font></a><font size="4"> 版权归作者所有,欢迎转载!如有转载,请务必注明出处!未经本文作者同意不得用于商业应用。</font></p>
<p><font size="4">其实这里考察的RETAIN到底是在非执行语句还是执行语句。<br>
RETAIN的作用是初始化变量为&ldquo;特定的默认值&rdquo;,是非执行语句,在编译过程中,PDV中用&ldquo;特定的默认值&rdquo;替代SAS系统默认值。在DATA步中,加入STATE进入PDV中,STATE='California'; 是赋值语句,也就是执行语句。每一次从SASHELP.CLASS读取数据之后,都要执行一次赋值语句。</font></p>
<p><font size="4">可以用下面的一个示例形容:<br>
1.老板现在想将一批东西搬到仓库里面去,就告诉秘书。一般来说,老板说话都是那么模糊或者不明确,秘书就开始思考老板的意思,咋个搬,按照老板的以前说话的经验,秘书开始布置仓库,老板说要搬东西,东西有五类(对应CLASS里面的5个变量),另外老板说还有一个东西,专门放老板喜欢吃的东西。秘书一想,老板就喜欢吃回锅肉嘛,那么就另外一个类东西就是回锅肉(对应CITY)。秘书开始给每一个存放东西的房间编号,1 2 3 4 5 6,第六个不用搬,每次都是回锅肉,只搬一次搞定,因为秘书都猜到老板的心思了。但是其他六类就不知道了。<br>
2.秘书开始搬东西了,搬完5类东西之后,发现临时来了一个新东西需要放在仓库,只有在现在的仓库里面加一个房间,编号为7,瞧一瞧新东西的大小和样式,选择合适的房间编号为7进行存放这个东西。继续搬,每次搬东西进入这剩下的六个房间,1 2 3 4 5 7。</font></p>
<p> </p> <a href="http://hi.baidu.com/crack%5Fman/blog/item/50dfdd03f419bddd7a894788.html">阅读全文</a>
               
                <br/><b>类别:</b><a href="http://hi.baidu.com/crack%5Fman/blog/category/%B8%FAcrackman%D7%F6sas%20base%C8%CF%D6%A4%CA%D4%CC%E2">跟crackman做sas base认证试题</a>&nbsp;<a href="http://hi.baidu.com/crack%5Fman/blog/item/50dfdd03f419bddd7a894788.html#comment">查看评论</a>
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2026-2-3 14:51 , Processed in 0.124434 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表