SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

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

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

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2010-11-12 22:29:43 | 只看该作者

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

From crackman's blog on Baidu


               
                <p><font size="4">43.Given the SAS data set WORK.ORDERS:<br>
<br>
  WORK.ORDERS<br>
<br>
  order_id  customer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  shipped <br>
  --------  ------------&nbsp;&nbsp;  --------- <br>
  9341&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Josh Martin&nbsp;&nbsp;&nbsp;  02FEB2009 <br>
  9874&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Rachel Lords&nbsp;&nbsp;  14MAR2009 <br>
  10233&nbsp;&nbsp;&nbsp;&nbsp;  Takashi Sato&nbsp;&nbsp;  07JUL2009 <br>
<br>
The variable order_id is numeric; customer is character; and shipped is numeric, contains a SAS date value,and is shown with the DATE9. format.<br>
<br>
A programmer would like to create a new variable, ship_note,that shows a character value with the order_id,shipped date, and customer name.</font></p>
<p><font size="4">For example, given the first observation ship_note would have the value &quot;Order 9341 shipped on 02FEB2009 to Josh Martin&quot;.<br>
<br>
Which of the following statement will correctly create the value and assign it to ship_note?</font></p>
<p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;  A. ship_note=catx(' ','Order',order_id,'shipped on',input(shipped,date9.),'to',customer);<br>
&nbsp;&nbsp;&nbsp;&nbsp;  B. ship_note=catx(' ','Order',order_id,'shipped on',char(shipped,date9.),'to',customer);<br>
&nbsp;&nbsp;&nbsp;&nbsp;  C. ship_note=catx(' ','Order',order_id,'shipped on',transwrd(shipped,date9.),'to',customer);<br>
&nbsp;&nbsp;&nbsp;&nbsp;  D. ship_note=catx(' ','Order',order_id,'shipped on',put(shipped,date9.),'to',customer); </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">这里主要考察四个函数的问题,最容易混淆的是INPUT和PUT两个函数。<br>
看看下面的英文解释。<br>
INPUT:To perform character-to-numeric conversion. Also useful in converting<br>
character values such as dates into true SAS numeric date values.</font></p>
<p><font size="4">Syntax: INPUT(value, informat)<br>
</font><font size="4"><strong><font style="background-color: #ffff00">value is a character variable or character expression.<br>
</font></strong>informat is a SAS or user-defined informat.</font></p>
<p><font size="4">PUT:To perform numeric-to-character conversion or to create a character variable<br>
from a user-defined format. The result of a PUT function is always a<br>
character value.</font></p>
<p><font size="4">Syntax: PUT(value, format)<br>
</font><font size="4"><strong><font style="background-color: #ffff00">value is a character or numeric SAS variable or expression.<br>
</font></strong>format is a SAS or user-defined format.</font></p>
<p> </p>
<p> </p> <a href="http://hi.baidu.com/crack%5Fman/blog/item/b132aeeba109c506fcfa3c7f.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/b132aeeba109c506fcfa3c7f.html#comment">查看评论</a>
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-2-3 16:34 , Processed in 0.079438 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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