支持Crackman版主,个人补充一点:
这个题还有一点需要注意,where语句是先执行的,firstobs= 和obs= 是作用在where语句的结果集上的(如本例的sex=“M”)。
而不是先找出数据集中的第5条至第15条记录,然后从这11条记录中找sex=“M”的。
例如:
输出sashelp.class的第2-5条记录,只有1条记录的sex="M"。
proc print data=sashelp.class(firstobs=2 obs=5);
run;
/**output;
Obs Name Sex Age Height Weight
2 Alice F 13 56.5 84.0
3 Barbara F 13 65.3 98.0
4 Carol F 14 62.8 102.5
5 Henry M 14 63.5 102.5
*/
加上where语句后仍然会输出4条记录,而不是1条。
proc print data=sashelp.class(firstobs=2 obs=5);
where sex="M";
run;
/*output
Obs Name Sex Age Height Weight
5 Henry M 14 63.5 102.5
6 James M 12 57.3 83.0
9 Jeffrey M 13 62.5 84.0
10 John M 12 59.0 99.5
*/
题目中的选项(D. 11 or fewer)中,fewer的情况只有在数据集中满足where条件的记录数小于obs=选项指定的数(本例15)时才会出现。