|
|
楼主

楼主 |
发表于 2010-11-12 18:27:10
|
只看该作者
跟crakman做sas base认证试题(42)
From crackman's blog on Baidu
<p><font size="4">42.The following SAS program is submitted:<br>
<br>
data WORK.ONE;<br>
Text='Australia, US, Denmark';<br>
Pos=find(Text,'US','i',5);<br>
run;<br>
<br>
What value will SAS assign to Pos? </font></p>
<p><font size="4"> A. 0<br>
B. 1<br>
C. 2<br>
D. 12</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">本题考察的是SAS中FIND函数的应用。<br>
POS=FIND(Text,'US','i',5)解释为:<br>
从Australia, US, Denmark 字符串的第五个字符开始,忽略字符串中大小写,寻找字符串US在源字符串中的起始位置,并返回起始位置的数字给POS。<br>
几个问题值得思考,第一个是如果没有'i'这个参数,结果会怎么样?如果把5改成1,那么结果又如何?<br>
看看SAS官网网站的解释:<br>
Syntax <br>
FIND(string,substring<,modifiers><,startpos>) <br>
FIND(string,substring<,startpos><,modifiers>) </font></p>
<p><font size="4">Searches for a specific substring of characters within a character string. </font></p>
<p><font size="4">Arguments</font></p>
<p><font size="4">string <br>
specifies a character constant, variable, or expression that will be searched for substrings.</font></p>
<p><font size="4">Tip: Enclose a literal string of characters in quotation marks. </font></p>
<p><font size="4">substring <br>
is a character constant, variable, or expression that specifies the substring of characters to search for in string.</font></p>
<p><font size="4">Tip: Enclose a literal string of characters in quotation marks. </font></p>
<p><font size="4">modifiers <br>
is a character constant, variable, or expression that specifies one or more modifiers. The following modifiers can be in uppercase or lowercase:</font></p>
<p><font size="4">i ignores character case during the search. If this modifier is not specified, FIND only searches for character substrings with the same case as the characters in substring.<br>
<br>
t trims trailing blanks from string and substring.</font></p>
<p><font size="4">Note: If you want to remove trailing blanks from only one character argument instead of both (or all) character arguments, use the TRIM function instead of the FIND function with the T modifier. <br>
<br>
Tip: If modifier is a constant, enclose it in quotation marks. Specify multiple constants in a single set of quotation marks. Modifier can also be expressed as a variable or an expression. </font></p>
<p><font size="4">startpos <br>
is a numeric constant, variable, or expression with an integer value that specifies the position at which the search should start and the direction of the search.</font></p>
<p><font size="4"><br>
</font> </p> <a href="http://hi.baidu.com/crack%5Fman/blog/item/de2cb53a227d66ea838b1335.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> <a href="http://hi.baidu.com/crack%5Fman/blog/item/de2cb53a227d66ea838b1335.html#comment">查看评论</a> |
|