SASBase认证考试70题5160.docx
《SASBase认证考试70题5160.docx》由会员分享,可在线阅读,更多相关《SASBase认证考试70题5160.docx(9页珍藏版)》请在冰豆网上搜索。
SASBase认证考试70题5160
Q51
Thefollowingprogramissubmitted:
proccontentsdata=_all_;
run;
Whichstatementbestdescribestheoutputfromthesubmittedprogram?
A.TheoutputcontainsonlyalistoftheSASdatasetsthatarecontainedintheWORKlibrary.
B.TheoutputdisplaysonlythecontentsoftheSASdatasetsthatarecontainedintheWORKlibrary.
C.TheoutputdisplaysonlythevariablesintheSASdatasetsthatarecontainedintheWORKlibrary.
D.TheoutputcontainsalistoftheSASdatasetsthatarecontainedintheWORKlibraryanddisplaysthecontentsofthosedatasets.
答案:
D
本题知识点:
PROCCOTENTS过程
参考第22题。
Q52
GiventheSASdatasetWORK.EMP_NAME:
Name EmpID
---- -----
Jill 1864
Jack 2121
Joan 4698
John 5463
GiventheSASdatasetWORK.EMP_DEPT:
EmpID Department
----- ----------
2121 Accounting
3567 Finance
4698 Marketing
5463 Accounting
Thefollowingprogramissubmitted:
dataWORK.ALL;
mergeWORK.EMP_NAME(in=Emp_N)
WORK.EMP_DEPT(in=Emp_D);
byEmpid;
if(Emp_NandnotEmp_D)or(Emp_DandnotEmp_N);
run;
HowmanyobservationsareindatasetWORK.ALLaftersubmittingtheprogram?
A.1
B.2
C.3
D.5
答案:
B
本题知识点:
MERGE合并数据集、IF子集
找出两个数据集中不重合的观测个数。
Q53
ThefollowingSASprogramissubmitted:
dataWORK.TOTAL_SALARY;
retainTotal;
setWORK.SALARY;
byDepartment;
ifFirst.Department
thenTotal=0;
Total=sum(Total,Wagerate);
ifLast.Total;
run;
WhatistheinitialvalueofthevariableTotal?
A.0
B.Missing
C.ThevalueofthefirstobservationsWagerate
D.Cannotbedeterminedfromtheinformationgiven
答案:
B
本题知识点:
RETAIN语句
retain语句是非执行语句。
retain;/*针对所有变量*/
retainxy;
retainx1-x5;
retainx1-x510ab‘abc’;
retainx1-x5
(1);/*x1=1,其余为缺失值*/
retainx1-x4(1234);
retainx1-x4(1:
4);
arrayarr
(2)xy;retainarr;
Q54
Considerthefollowingdatastep:
dataWORK.TEST;
setSASHELP.CLASS(obs=5);
retainCity'BeverlyHills';
State='California';
run;
ThecomputedvariablesCityandStatehavetheirvaluesassignedusingtwodifferentmethods,aRETAINstatementandanAssignmentstatement.Whichstatementregardingthisprogramistrue?
A.TheRETAINstatementisfine,butthevalueofCitywillbetruncatedto8bytesastheLENGTHstatementhasbeenomitted.
B.BoththeRETAINandassignmentstatementarebeingusedtoinitializenewvariablesandareequallyefficient.Methodusedisamatterofprogrammerpreference.
C.Theassignmentstatementisfine,butthevalueofCitywillbetruncatedto8bytesastheLENGTHstatementhasbeenomitted.
D.City'svaluewillbeassignedonetime,State'svalue5times.
答案:
D
本题知识点:
RETAIN语句
一般,SAS每读一遍DATA步的所有语句,PDV清空所有所有变量值,并设置为缺失值。
再执行INPUT语句或赋值语句,再次对变量赋值。
如果在DATA步中使用RETAIN语句,不会清空RETAIN对应的变量,保留到该变量下次再次被执行。
Q55
ThefollowingSASprogramissubmitted:
dataWORK.DATE_INFO;
X="01Jan1960"D;
run;
VariableXcontainswhatvalue?
A.thenumericvalue0
B.thecharactervalue"01Jan1960"
C.thedatevalue01011960
D.thecodecontainsasyntaxerroranddoesnotexecute.
答案:
D
本题知识点:
日期时间的表示格式
起点:
1960年1月1日0时0分0秒。
若将日期时间标示为数值型常数,需使用相应格式。
格式值带单引号,后紧跟跟一个D(日期)、T(时间)、DT(日期时间)。
在表示为数值常数时,不支持MMDDYYw.格式,支持datew.格式。
本题,答案C,是因为X="01Jan1960"D;中D之前有个空格。
若改为X="01Jan1960"D;,答案就是A。
若改为X="01011960"D;,答案就是D。
Q56
ThefollowingoutputiscreatedbytheFREQUENCYprocedure:
TheFREQProcedure
Tableofregionbyproduct
region product
Frequency|
Percent |
RowPct |
ColPct |corn |cotton |oranges| Total
---------+--------+--------+--------+
EAST | 2| 1| 1| 4
| 22.22| 11.11| 11.11| 44.44
| 50.00| 25.00| 25.00|
| 50.00| 33.33| 50.00|
---------+--------+--------+--------+
SOUTH | 2| 2| 1| 5
| 22.22| 22.22| 11.11| 55.56
| 40.00| 40.00| 20.00|
| 50.00| 66.67| 50.00|
---------+--------+--------+--------+
Total 4 3 2 9
44.44 33.33 22.22 100.00
WhichTABLESstatementwasusedtocompletedthefollowingprogramthatproducedtheoutput?
procfreqdata=sales;
<_insert_code_>
run;
A.tablesregionproduct;
B.tablesregion,product
C.tablesregion/product;
D.tablesregion*product;
答案:
D
本题知识点:
PROCFREQ过程
参考第47题。
Q57
GiventheSASdatasetWORK.ONE:
N BeginDate
- ---------
1 09JAN2010
2 12JAN2010
ThefollowingSASprogramissubmitted:
dataWORK.TWO;
setWORK.ONE;
Day=<_insert_code_>;
formatBeginDatedate9.;
run;
ThedatasetWORK.TWOiscreated,whereDaywouldbe1forSunday,2forMonday,3forTuesday,...:
WORK.TWO
N B