SAS中文论坛

标题: 跟crakman做sas base认证试题(58) [打印本页]

作者: shiyiming    时间: 2010-11-13 15:39
标题: 跟crakman做sas base认证试题(58)
From crackman's blog on Baidu


               
                <p><font size="4" face="宋体">58.The following program is submitted:<br>
<br>
  proc format; <br>
&nbsp;&nbsp;&nbsp;&nbsp;  value salfmt. <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  0 -&lt; 50000&nbsp;&nbsp;  = 'Less than 50K'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  50000 - high = '50K or Greater'; <br>
<br>
  options fmterr nodate pageno=1;<br>
  title 'Employee Report'; <br>
<br>
  proc print data=work.employees noobs;<br>
&nbsp;&nbsp;&nbsp;&nbsp;  var fullname salary hiredate; <br>
&nbsp;&nbsp;&nbsp;&nbsp;  format<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  salary salfmt. <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  hiredate date9.;<br>
&nbsp;&nbsp;&nbsp;&nbsp;  label <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  fullname='Name of Employee'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  salary='Annual Salary' <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  hiredate='Date of Hire';<br>
  run;<br>
<br>
Why does the program fail?</font></p>
<p><font size="4" face="宋体">&nbsp;&nbsp;&nbsp;&nbsp;  A. The PAGENO option is invalid in the OPTIONS statement.<br>
&nbsp;&nbsp;&nbsp;&nbsp;  B. The RUN statement is missing after the FORMAT procedure. <br>
&nbsp;&nbsp;&nbsp;&nbsp;  C. The format name contains a period in the VALUE statement.<br>
&nbsp;&nbsp;&nbsp;&nbsp;  D. The LABEL option is missing from the PROC PRINT statement.</font></p>
<p><font size="4" face="宋体">Answer: C</font></p>
<p><font size="4" face="宋体">错误就在PROC FORMAT语句中,value的命名salfmt. 不应搞包括DOT(.)。<br>
这个点号是SAS用来区别一个变量名以及一个format格式名称的差别。<br>
看看英文一个说明:<br>
The period (or &ldquo;dot&rdquo;) in the Format<br>
distinguishes it from a Variable Name. When SAS &ldquo;sees&rdquo; the &ldquo;dot,&rdquo; it &ldquo;knows&rdquo; to associate the instructions in </font><font size="4" face="宋体">the  given Format to the Variable. Since SAS Variable Names can only contain letters, numbers and the underscore symbol, the period symbol is how SAS detects the difference between a Variable and a Format</font></p> <a href="http://hi.baidu.com/crack%5Fman/blog/item/750f4a127e2d105a21a4e97c.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/750f4a127e2d105a21a4e97c.html#comment">查看评论</a>




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2