BASE机经变形题总结.pdf
《BASE机经变形题总结.pdf》由会员分享,可在线阅读,更多相关《BASE机经变形题总结.pdf(40页珍藏版)》请在冰点文库上搜索。
3/3/2015(109)QUESTION109ThecontentsoftherawdatafileEMPLOYEEarelistedbelow:
-|-10-|-20-|-30Ruth3911Jose3222Sue3033John4044ThefollowingSASprogramissubmitted:
datatest;infileemployee;inputemployee_name$1-4;ifemployee_name=Suetheninputage7-8;elseinputidnum10-11;run;WhichoneofthefollowingvaluesdoesthevariableAGEcontainwhenthenameoftheemployeeisSue?
A.30B.33C.40D.(missingnumericvalue)QUESTION110ThecontentsoftherawdatafileEMPLOYEEarelistedbelow:
-|-10-|-20-|-30Ruth3911Jose3222Sue3033John4044ThefollowingSASprogramissubmitted:
datatest;infileemployee;inputemployee_name$1-4;ifemployee_name=Ruthhtheninputidnum10-11;elseinputage7-8;runWhichoneofthefollowingvaluesdoesthevariableIDNUMcontainwhenthenameoftheemployeeisRuth?
A.11B.22(33)C.32D.(missingnumericvalue)Answer:
B机经:
正如各位前辈所言,70以及变形一定要看。
今天考到的有:
4,13,16,17,20,21(gt50),22,24,30,31,32,34,35(output变为elseoutput),40(dowhile(prodle6)改为(dountil(prodgt6),42(变为填空,US放在了最前面),46,47,51,53,56,57,60,61,63,65,66(在第一个end后面加了output,求X值),67(ifX10thenX=1改为X=3),69,70(题目改为根据log内容,判断错误内容)70题的变型全部考到,全新题在7-8题1)ThefollowingSASprogramissubmitted:
dataWORK.TOTAL;setWORK.SALARY;byDepartmentGender;ifFirst.thenPayroll=0;Payroll+Wagerate;ifLast.;run;TheSASdatasetWORK.SALARYiscurrentlyorderedbyGenderwithinDepartment.WhichinsertedcodewillaccumulatesubtotalsforeachGenderwithinDepartment?
A.Gender_insert_code__insert_code_B.DepartmentC.GenderDepartmentD.DepartmentGenderAnswer:
A18.WhichstatementdescribesacharacteristicoftheSASautomaticvariable_ERROR_?
A.The_ERROR_variablemaintainsacountofthenumberofdataerrorsinaDATAstep.B.The_ERROR_variableisaddedtotheprogramdatavectorandbecomespartofthedatasetbeingcreated.C.The_ERROR_variablecanbeonlyusedinexpressionsintheDATAstep.D.The_ERROR_variablecontainsthenumberoftheobservationthatcausedthedataerror.Answer:
C9)ThefollowingSASprogramissubmitted:
procformat;valuescore1-50=Fail51-100=Pass;run;procreportdata=work.coursesnowd;columnexam;defineexam/displayformat=score.;run;ThevariableEXAMhasavalueof50.5.HowwilltheEXAMvariablevaluebedisplayedintheREPORTprocedureoutput?
A.FailB.PassC.50.5D.(missingnumericvalue)答案:
C19)TheSASdatasetWORK.ONEcontainsanumericvariablenamedNumandacharactervariablenamedChar:
WORK.ONENumChar-123323177ThefollowingSASprogramissubmitted:
procprintdata=WORK.ONE;whereNum=1;Num=contain
(1);没contain这个函数run;Whatisoutput?
A.NumChar-123B.NumChar-123177C.NumChar-123323177D.Nooutputisgenerated.Answer:
D(num+char,wherestatmentcannotwork)21)GiventheSASdatasetWORK.PRODUCTS:
ProdIdPriceProductTypeSalesReturns-K12S95.50OUTDOOR152B132S2.99CLOTHING30010R18KY251.99EQUIPMENT2553KL8BY6.39OUTDOOR12515DY65DW5.60OUTDOOR455DGTY2334.55EQUIPMENT672ThefollowingSASprogramissubmitted:
dataWORK.OUTDOORWORK.CLOTHWORK.EQUIP;setWORK.PRODUCTS;ifSalesGT50;ifProductTypeEQOUTDOORthenoutputWORK.OUTDOOR;elseifProductTypeEQCLOTHINGthenoutputWORK.CLOTH;elseifProductTypeEQEQUIPMENTthenoutputWORK.EQUIP;run;HowmanyobservationsdoestheWORK.OUTDOORdatasetcontain?
A.1B.2C.3D.6Answer:
B27.GiventheSASdatasetWORK.TEMPS:
DayMonthTemp-1May7515May7015June803June762July8514July89Thefollowingprogramissubmitted:
procsortdata=WORK.TEMPS;bydescendingMonthDaybydaydescendingMonth;run;procprintdata=WORK.TEMPS;run;WhichoutputIscorrect?
33)ThefollowingSASprogramissubmitted:
dataWORK.TEST;setWORK.PILOTS;ifJobcode=Pilot2thenDescription=SeniorPilot;elseDescription=Unknown;run;ThevalueforthevariableJobcodeis:
PILOT2.WhatisthevalueofthevariableDescription?
A.PILOT2B.UnknownC.SeniorPilotD.(missingcharactervalue)Answer:
B35)xy521356题目改成了,ifx=5thenoutputone;ifylt5thenoutputtwo;elseoutputother;Howmanyobservationsineachdataset?
答案是2forone,2fortwo,1forother.35)giventheSASdatasetSASDATA.TWO:
XY-523156ThefollowingSASprogramissubmitted:
dataSASUSER.ONESASUSER.TWOOTHER;setSASDATA.TWO;ifXeq5thenoutputSASUSER.ONE;ifYlt5thenoutputSASUSER.TWO;elseoutput;run;Whatistheresult?
A.datasetSASUSER.ONEhas5observationsdatasetSASUSER.TWOhas5observationsdatasetWORK.OTHERhas3observationsB.datasetSASUSER.ONEhas2observationsdatasetSASUSER.TWOhas2observationsdatasetWORK.OTHERhas1observationsC.datasetSASUSER.ONEhas2observationsdatasetSASUSER.TWOhas2observationsdatasetWORK.OTHERhas5observationsD.Nodatasetsareoutput.TheDATAstepfailsexecutionduetosyntaxerrors.Answer:
A36)GiventhecontentsoftherawdatafileEMPLOYEE.TXT:
-+-10-+-20-+-30-Xing1922004ACCTBob5222004MKTGJorge3142004EDUCThefollowingSASprogramissubmitted:
dataWORK.EMPLOYEE;infileEMPLOYEE.TXT;input1FirstName$15StartDate25Department$;run;WhichSASinformatcorrectlycompletestheprogram?
A.date9.B.mmddyy10.C.ddmmyy10.D.mondayyr10.Answer:
B42)ThefollowingSASprogramissubmitted:
dataWORK.ONE;Text=US-AustriliaDenmark;Pos=find(Text,US,i,5);run;WhatvaluewillSASassigntoPos?
A.0B.1C.2D.12Answer:
D填空题,给出find(US-Austrilia.,US,i,5)的具体数值,答案是填5(在8字符里面)44)ThefollowingSASprogramissubmitted:
dataONETWOSASUSER.TWO;setSASUSER.ONE;run;AssumingthatSASUSER.ONEexists,howmanytemporaryandpermanentSASdatasetsarecreated?
A.2temporaryand1permanentSASdatasetsarecreatedB.3temporaryand2permanentSASdatasetsarecreatedC.2temporaryand2permanentSASdatasetsarecreatedD.thereisanerrorandnonewdatasetsarecreatedAnswer:
D46)GiventheSASdatasetWORK.ONE:
ObsRevenue2007Revenue2008Revenue2009Revenue2010-11.21.62.0ThefollowingSASprogramissubmitted:
dataWORK.TWO;setWORK.ONE;Total=mean(ofRev:
);run;WhatvaluewillSASassigntoTotal?
A.3B.1.6C.4.8D.Theprogramfailstoexecuteduetoerrors.Revenue2007对应的值为.计算.1.21.62.0的平均值选项变成了A.B.1.0C.1.6D.Theprogramfailstoexecuteduetoerrors.Answer:
B52.GiventheSASdatasetWORK.EMP_NAME:
NameEmpID-Jill1864Jack2121Joan4698John5463GiventheSASdatasetWORK.EMP_DEPT:
EmpIDDepartment-2121Accounting3567Finance4698Marketingxxxxxxxxxxxxxxx5463AccountingThefollowingprogramissubmitted:
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.1B.2C.3D.552)GiventheSASdatasetWORK.EMP_NAME:
NameEmpID-Jill1864Jack2121Joan4698John5463注意它变了!
Emp_N里面有两个不在Emp_D里,所以最后选3.GiventheSASdatasetWORK.EMP_DEPT:
EmpIDDepartment-2121Accounting3567Finance4698Marketing5463AccountingThefollowingprogramissubmitted:
dataWORK.ALL;mergeWORK.EMP_NAME(in=Emp_N)WORK.EMP_DEPT(in=Emp_D);byEmpid;if(Emp_NandnotEmp_D)or(Emp_DandnotEmp_N);run;Howmanyobservations(填空)areindatasetWORK.ALLaftersubmittingtheprogram?
A.1B.2C.3D.555.ThefollowingSASprogramissubmitted:
dataWORK.DATE_INFO;X=01Jan1960Drun;VariableXcontainswhatvalue?
A.thenumericvalue0B.thecharactervalue01Jan1960C.thedatevalue01011960D.thecodecontainsasyntaxerroranddoesnotexecute.Answer:
D57)GiventheSASdatasetWORK.ONE:
NBeginDate-109JAN2010212JAN2010ThefollowingSASprogramissubmitted:
dataWORK.TWO;setWORK.ONE;Day=;formatBeginDatedate9.;run;ThedatasetWORK.TWOiscreated,whereDaywouldbe1forSunday,2forMonday,3forTuesday,.:
WORK.TWONBeginDateDay-109JAN20101212JAN20104WhichexpressionsuccessfullycompletedtheprogramandcreatesthevariableDay?
A.day(BeginDate)果然变成了输出日期,所以是day()B.weekday(BeginDate)C.dayofweek(BeginDate)D.getday(BeginDate,today()Answer:
B60)GiventheSASdatasetWORK.PRODUCTS:
ProdIdPriceProductTypeSalesReturns-K12S95.50OUTDOOR152B132S2.99CLOTHING30010R18KY251.99EQUIPMENT2553KL8BY6.39OUTDOOR12515DY65DW5.60OUTDOOR455DGTY2334.55EQUIPMENT672ThefollowingSASprogramissubmitted:
dataWORK.REVENUE(drop=SalesReturnsPrice);setWORK.PRODUCTS(keep=ProdIdPriceSalesReturns);Revenue=Price*(Sales-Returns);run;HowmanyvariablesdoestheWORK.REVENUEdatasetcontain?
A.2B.3C.4D.6Answer:
A66)ThefollowingSASprogramissubmitted:
dataWORK.SALES;doYear=1to5;doMonth=1to12;X+1;Output=60end;Output=5end;run;Howmanyobservations(填空)arewrittentotheWORK.SALESdataset?
A.0B.1C.5D.60Answer:
Boutput的位置不同,答案也不同。
我在SAS里跑过,应该是这样的:
(1)dovar1=1to7;dovar2=1to12;X+1;output;end;end;run;输出7*12=84个observation
(2)dovar1=1to7;dovar2=1to12;X+1;end;output;end;run;输出7个observation(3)dovar1=1to7;dovar2=1to12;X+1;end;end;output;run;输出1个observation67)Considerthefollowingdatastep:
dataWORK.NEW;setWORK.OLD(keep=X);ifX=10ANDXLT20thenX=2;elseX=1;run;InfilteringthevaluesofthevariableXindatasetWORK.OLD,whatvaluenewvaluewouldbeassignedtoXifitsoriginalvaluewasamissingvalue?
A.Xwouldgetavalueof1.B.Xwouldgetavalueof3.C.Xwouldretainitsoriginalvalueofmissing.D.Thisstepdoesnotrunbecauseofsyntaxerrors.Answer:
A变成了ifX10thenX=3;elseX=1;所以选3.寂静:
1.proccontentsdata=sasuser._all_后面要加个什么语句,才能suppressestheprintingofdetailedinformationabouteachfileintheoutput;NODETAILS2.put(date,worddate20.)如之前总结的,选put(date,worddate20.)April15,19993.split=“*”一个data步中有一个label里面是这样的“xxxxx*xxxx*xxxx”,想在真正的label中*变空格,叫你选语句填空.类似“cat*dog”这样的格式,怎样实现将*指定为分隔符,实际输出“catdog”的形式呢?
答案选split=“*”4.几个有效的datasetnameDATAWORK.one-test(test_2Test好像还有几个不记得了但是最后答案是一共4个有效SASdatasetnamescanbe1to32characterslong,mustbeginwithaletter(AZ,eitheruppercaseorlowercase)oranunderscore(_),andcancontinuewithanycom