<p></p><p>
</p><p></p><p></p><p> </p><p></p><p></p><p></p><p></p><p> </p><p></p><p>SAS认证220道<br/> 练习题及详细答案, 题目覆盖了所有SAS BASE 考试所涉及到的范围。 </p><p></p><p></p><p>例子1 </p><p></p><p></p><p>Suppose the YEARCUTOFF= system option is set to 1920. An input file contains the date expression 12/08/1925, which is being read with the MMDDYY8. informat. Which date will appear in your data? </p><p></p><p></p><p>a. 08DEC1920 </p><p></p><p></p><p>b. 08DEC1925 </p><p></p><p></p><p>c. 08DEC2019 </p><p></p><p></p><p>d. 08DEC2025<br/> </p><p></p><p></p><p></p><p> </p><p></p><p>Correct answer: c<br/> </p><p></p><p></p><p>The w value of the informat MMDDYY8. is too small to read the entire value, so the last two digits of the year are truncated. The last two digits thus become 19 instead of 25. Because the YEARCUTOFF= system option is set to 1920, SAS interprets this year as 2019. To avoid such errors, be sure to specify an informat that is wide enough for your date expressions. </p><p></p><p></p><p></p><p> </p><p></p><p>例子2 </p><p></p><p></p><p>What is the length of the variable Type, as created in the DATA step below? </p><p></p><p></p>data finance.newloan;<p></p> set finance.records;<p></p> TotLoan+payment;<p></p> if code='1' then Type='Fixed';<p></p> else Type='Variable';<p></p> length type $ 10;<p></p>run;<p></p><p>a. 5 </p><p></p><p></p><p>b. 8 </p><p></p><p></p><p>c. 10 </p><p></p><p></p><p>d. It depends on the first value of Type </p><p></p><p></p><p></p><p> </p><p></p><p>Correct answer: a<br/> </p><p></p><p></p><p>The length of a new variable is determined by the first reference in the DATA step, not by data values. In this case, the length of Type is determined by the value Fixed. The LENGTH statement is in the wrong place; it must be read before any other reference to the variable in the DATA step. The LENGTH statement cannot change the length of an existing variable </p><p></p><p></p><p></p>
[此贴子已经被angelboy于2008-4-25 14:58:16编辑过]