SASBase认证考试70题6170.docx
《SASBase认证考试70题6170.docx》由会员分享,可在线阅读,更多相关《SASBase认证考试70题6170.docx(9页珍藏版)》请在冰豆网上搜索。
SASBase认证考试70题6170
SAS-Base认证考试—70题(61-70)
odsfileclose;
C.odshtmlfile='sales.html';
odshtmlclose;
D.odsfilehtml='sales.html';
odsfileclose;
答案:
C
本题知识点:
PROCCOTENTS过程
ODS的主要输出目标:
LISTING、RESULTS、OUTPUT、HTML、CSVALL、RTF、PDF、其他。
ODSHTML适用于数据较少的数据集、或汇总的数据集,如TABULATE过程。
Q63
ThefollowingSASprogramissubmitted:
dataWORK.OUTDS;
dountil(ProdGT6);
Prod+1;
end;
run;
WhatisthevalueofthevariableProdintheoutputdataset?
A..(missing)
B.6
C.7
D.Undetermined,infiniteloop.
答案:
C
本题知识点:
WHERE语句
参考第40题。
Q64
ThefollowingSASprogramissubmitted:
datawork.accounting;
lengthjobcode$12;
setwork.department;
run;
TheWORK.DEPARTMENTSASdatasetcontainsacharactervariablenamedJOBCODEwithalengthof5.
WhichofthefollowingisthelengthofthevariableJOBCODEintheoutputdataset?
A.5
B.8
C.12
D.Thelengthcannotbedeterminedastheprogramfailstoexecuteduetoerrors.
答案:
C
本题知识点:
LENGTH语句
LEGTH规定的是变量的字节长度,不是格式,不能含小数点。
LENGTHvariable-specification(s)
其中,DEFAULT=n是规定新建的数值变量的默认长度8改为n。
∙数值变量
对于数值变量,LENGTH范围为3-8字节。
LENGTH可放在任意位置。
在PROCSQL中ALERT不能改变数值变量长度。
∙字符变量
对于字符变量,LENGTH范围为1-32767字节,空格占一个字符。
LENGTH必须放在SET语句之前。
实际上,较少使用LENGTH语句,而是通过PROCSQL中ALERT改变字符变量长度。
Q65
ThefollowingSASprogramissubmitted:
dataWORK.ACCOUNTING;
setWORK.DEPARTMENT;
labelJobcode='JobDescription';
run;
Whichstatementistrueabouttheoutputdataset?
A.ThelabelofthevariableJobcodeisJob(onlythefirstword).
B.ThelabelofthevariableJobcodeisJobDesc(onlythefirst8characters).
C.ThelabelofthevariableJobcodeisJobDescription.
D.Theprogramfailstoexecuteduetoerrors.LabelsmustbedefinedinaPROCstep.
答案:
C
本题知识点:
LABEl标签语句
参考第37题。
Q66
ThefollowingSASprogramissubmitted:
dataWORK.SALES;
doYear=1to5;
doMonth=1to12;
X+1;
end;
end;
run;
HowmanyobservationsarewrittentotheWORK.SALESdataset?
A.0
B.1
C.5
D.60
答案:
B
本题知识点:
默认的OUTPUT语句
参考第40题。
Q67
Considerthefollowingdatastep:
dataWORK.NEW;
setWORK.OLD(keep=X);
ifX<10thenX=1;
elseifX>=10ANDXLT20thenX=2;
elseX=3;
run;
InfilteringthevaluesofthevariableXindatasetWORK.OLD,whatvaluenewvaluewouldbeassignedtoXifitsoriginalvaluewasamissingvalue?
A.Xwouldgetavalueof1.
B.Xwouldgetavalueof3.
C.Xwouldretainitsoriginalvalueofmissing.
D.Thisstepdoesnotrunbecauseofsyntaxerrors.
答案:
A
本题知识点:
缺失值的计算
逻辑计算时按ASCII进行比较,
缺失值主要是空格(ASCII值为32)
和英文句号(ASCII值为46)。
0-9为48-57
A-Z为65-90
a-z为97-122
Q68
ThefollowingSASprogramissubmitted:
dataWORK.ACCOUNTING;
setWORK.DEPARTMENT;
lengthEmpId$6;
CharEmpid=EmpId;
run;
IfdatasetWORK.DEPARTMENThasanumericvariableEmpId,whichstatementistrueabouttheoutputdataset?
A.ThetypeofthevariableCharEmpidisnumeric.
B.ThetypeofthevariableCharEmpidisunknown.
C.ThetypeofthevariableCharEmpidischaracter.
D.Theprogramfailstoexecuteduetoerrors.
答案:
D
本题知识点:
数据类型的转换、LENTH定义长度
参考第10题。
Q69
GiventhedatasetWORK.EMPDATA:
Employee_ Manager_
ID Job_Title Department ID
------- ---------------------- ---------------- ------
120101 Director SalesManagement 120261
120102 SalesManager SalesManagement 120101
120103 SalesManagerII SalesManagement 120101
120104 AdministrationManager Administration 120101
120105 SecretaryI Administration 120101
Whichoneofthefollowingwherestatementswoulddisplayobservationswithjobtitlescontainingtheword'Manager'?
A.wheresubstr(Job_Title,(length(Job_Title)-6))='Manager';
B.whereupcase(scan(Job_Title,-1,''))='MANAGER';
C.whereJob_Title='%Manager';
D.whereJob_Titlelike'%Manager%';
答案:
D
本题知识点:
WHERE语句
WHERE语句与数据集中WHERE选项是在观察读入PDV之前必须满足的一个条件。
WHEREwhere-expression-1
运算符
说 明
between and
选择一定数据范围的观测
ismissing/null
选择变量值为缺失值的观测
contain/?
选择包含规定字符的观察
like
匹配选择观测
same and
增加多个从句
LIKE:
下划线表示与一个字符匹配,百分号表示任意的多个字符。
Q70
AfteraSASprogramissubmitted,thefollowingiswrittentotheSASlog:
105 dataWORK.JANUARY;
106 setWORK.ALLYEAR(keep=ProductMonthQuantityCost);
107 ifMonth='JAN'thenoutputWORK.JANUARY;
108 Sales=Cost*Quantity;
109 drop=MonthQuantityCost;
-----
22
ERROR22-322:
Syntaxerror,expectingoneofthefollowing:
!
!
!
&,*,**,+,-,
,<=,<>,=,>,>=,
AND,EQ,GE,GT,IN,LE,LT,MAX,MIN,NE,NG,NL,
NOTIN,OR,^=,|,||,~=.
110 run;
WhatdatasetoptioncouldbeattachedtoWORK.JANUARYtoreplacetheDROPstatementthatgeneratedtheerrorinthelog?
A.(dropMonth Quantity Cost)
B.(dropMonth,Quantity,Cost)
C.(drop=Month,Quantity,Cost)
D.(drop=Month Quantity Cost)
答案:
D
本题知识点:
DROP选项
参考6题。
与KEEP=选项类似。