SASBase认证考试70题5160Word格式.docx
《SASBase认证考试70题5160Word格式.docx》由会员分享,可在线阅读,更多相关《SASBase认证考试70题5160Word格式.docx(9页珍藏版)》请在冰豆网上搜索。
Name
EmpID
----
-----
Jill
1864
Jack
2121
Joan
4698
John
5463
GiventheSASdatasetWORK.EMP_DEPT:
EmpID
Department
-----
----------
2121
Accounting
3567
Finance
4698
Marketing
5463
dataWORK.ALL;
mergeWORK.EMP_NAME(in=Emp_N)
WORK.EMP_DEPT(in=Emp_D);
byEmpid;
if(Emp_NandnotEmp_D)or(Emp_DandnotEmp_N);
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;
WhatistheinitialvalueofthevariableTotal?
A.0
B.Missing
C.ThevalueofthefirstobservationsWagerate
D.Cannotbedeterminedfromtheinformationgiven
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.
一般,SAS每读一遍DATA步的所有语句,PDV清空所有所有变量值,并设置为缺失值。
再执行INPUT语句或赋值语句,再次对变量赋值。
如果在DATA步中使用RETAIN语句,不会清空RETAIN对应的变量,保留到该变量下次再次被执行。
Q55
dataWORK.DATE_INFO;
X="
01Jan1960"
D;
VariableXcontainswhatvalue?
A.thenumericvalue0
B.thecharactervalue"
C.thedatevalue01011960
D.thecodecontainsasyntaxerroranddoesnotexecute.
日期时间的表示格式
起点:
1960年1月1日0时0分0秒。
若将日期时间标示为数值型常数,需使用相应格式。
格式值带单引号,后紧跟跟一个D(日期)、T(时间)、DT(日期时间)。
在表示为数值常数时,不支持MMDDYYw.格式,支持datew.格式。
本题,答案C,是因为X="
中D之前有个空格。
若改为X="
D;
,答案就是A。
01011960"
,答案就是D。
Q56
ThefollowingoutputiscreatedbytheFREQUENCYprocedure:
TheFREQProcedure
Tableofregionbyproduct
region
product
Frequency|
Percent
|
RowPct
ColPct
|corn
|cotton
|oranges|
Total
---------+--------+--------+--------+
EAST
|
2|
1|
4
22.22|
11.11|
44.44
50.00|
25.00|
25.00|
33.33|
50.00|
SOUTH
5
55.56
40.00|
20.00|
66.67|
Total
4
3
2
9
44.44
33.33
22.22
100.00
WhichTABLESstatementwasusedtocompletedthefollowingprogramthatproducedtheoutput?
procfreqdata=sales;
<
_insert_code_>
A.tablesregionproduct;
B.tablesregion,product
C.tablesregion/product;
D.tablesregion*product;
PROCFREQ过程
参考第47题。
Q57
GiventheSASdatasetWORK.ONE:
N
BeginDate
-
---------
1
09JAN2010
12JAN2010
dataWORK.TWO;
setWORK.ONE;
Day=<
formatBeginDatedate9.;
ThedatasetWORK.TWOiscreated,whereDaywouldbe1forSunday,2forMonday,3forTuesday,...:
WORK.TWO
N
B