SAS认证220道练习题及详细答案.docx
《SAS认证220道练习题及详细答案.docx》由会员分享,可在线阅读,更多相关《SAS认证220道练习题及详细答案.docx(107页珍藏版)》请在冰豆网上搜索。
SAS认证220道练习题及详细答案
SASCertificateBasePracticeQuestionsandDetailedAnswers
Chapter1:
BasicConcepts
Chapter2:
ReferencingFilesandSettingOptions
Chapter3:
EditingandDebuggingSASPrograms
Chapter4:
CreatingListReports
Chapter5:
CreatingSASDataSetsfromRawData
Chapter6:
UnderstandingDATAStepProcessing
Chapter7:
CreatingandApplyingUser-DefinedFormats
Chapter8:
CreatingEnhancedListandSummaryReports
Chapter9:
ProducingDescriptiveStatistics
Chapter10:
ProducingHTMLOutput
Chapter11:
CreatingandManagingVariables
Chapter12:
ReadingSASDataSets
Chapter13:
CombiningSASDataSets
Chapter14:
TransformingDatawithSASFunctions
Chapter15:
GeneratingDatawithDOLoops
Chapter16:
ProcessingVariableswithArrays
Chapter17:
ReadingRawDatainFixedFields
Chapter18:
ReadingFree-FormatData
Chapter19:
ReadingDateandTimeValues
Chapter20:
CreatingaSingleObservationfromMultipleRecords
Chapter21:
CreatingMultipleObservationsfromaSingleRecord
Chapter22:
ReadingHierarchicalFiles
1
Chapter1:
BasicConceptsAnswerKey
1.Howmanyobservationsandvariablesdoesthedatasetbelowcontain?
a.3observations,4variables
b.3observations,3variables
c.4observations,3variables
d.can'ttellbecausesomevaluesaremissing
Correct
answer:
c
Rowsinthedatasetarecalledobservations,andcolumnsarecalledvariables.Missingvalues
don'taffectthestructureofthedataset.
2.Howmanyprogramstepsareexecutedwhentheprogrambelowisprocessed?
datauser.tables;
infilejobs;
inputdatename$job$;
run;
procsortdata=user.tables;
byname;
run;
procprintdata=user.tables;
run;
a.three
b.four
c.five
d.six
Correct
answer:
a
WhenitencountersaDATA,PROC,orRUNstatement,SASstopsreadingstatementsand
2
executesthepreviousstepintheprogram.TheprogramabovecontainsoneDATAstepand
twoPROCsteps,foratotalofthreeprogramsteps.
3.WhattypeofvariableisthevariableAcctNuminthedatasetbelow?
a.numeric
b.character
c.canbeeithercharacterornumeric
d.can'ttellfromthedatashown
Correct
answer:
b
Itmustbeacharactervariable,becausethevaluescontainlettersandunderscores,whichare
notvalidcharactersfornumericvalues.
4.WhattypeofvariableisthevariableWearinthedatasetbelow?
a.numeric
b.character
c.canbeeithercharacterornumeric
d.can'ttellfromthedatashown
Correct
answer:
a
Itmustbeanumericvariable,becausethemissingvalueisindicatedbyaperiodratherthan
byablank.
3
5.Whichofthefollowingvariablenamesisvalid?
a.4BirthDate
b.$Cost
c._Items_
d.Tax-Rate
Correct
answer:
c
VariablenamesfollowthesamerulesasSASdatasetnames.Theycanbe1to32characters
long,mustbeginwithaletter(A–Z,eitheruppercaseorlowercase)oranunderscore,andcan
continuewithanycombinationofnumbers,letters,orunderscores.
6.WhichofthefollowingfilesisapermanentSASfile?
a.Sashelp.PrdSale
b.Sasuser.MySales
c.Profits.Quarter1
d.alloftheabove
Correct
answer:
d
TostoreafilepermanentlyinaSASdatalibrary,youassignitalibrefotherthanthedefault
Work.Forexample,byassigningthelibrefProfitstoaSASdatalibrary,youspecifythatfiles
withinthelibraryaretobestoreduntilyoudeletethem.Therefore,SASfilesintheSashelp
andSasuserlibrariesarepermanentfiles.
7.InaDATAstep,howcanyoureferenceatemporarySASdatasetnamedForecast?
a.Forecast
b.Work.Forecast
c.Sales.Forecast(afterassigningthelibrefSales)
d.onlyaandbabove
Correct
answer:
d
ToreferenceatemporarySASfileinaDATAsteporPROCstep,youcanspecifytheone-
4
levelnameofthefile(forexample,Forecast)orthetwo-levelnameusingthelibrefWork(for
example,Work.Forecast).
8.WhatisthedefaultlengthforthenumericvariableBalance?
a.5
b.6
c.7
d.8
Correct
answer:
d
ThenumericvariableBalancehasadefaultlengthof8.Numericvalues(nomatterhow
manydigitstheycontain)arestoredin8bytesofstorageunlessyouspecifyadifferentlength.
9.HowmanystatementsdoesthefollowingSASprogramcontain?
procprintdata=new.prodsale
labeldouble;
varstatedayprice1price2;wherestate='NC';
labelstate='NameofState';
run;
a.three
b.four
c.five
d.six
Correct
answer:
c
Thefivestatementsare
•PROCPRINTstatement(twolineslong)
5
•VARstatement
•WHEREstatement(onthesamelineastheVARstatement)
•LABELstatement
•RUNstatement(onthesamelineastheLABELstatement).
10.WhatisaSASdatalibrary?
a.acollectionofSASfiles,suchasSASdatasetsandcatalogs
b.insomeoperatingenvironments,aphysicalcollectionofSASfiles
c.insomeoperatingenvironments,alogicallyrelatedcollectionofSASfiles
d.alloftheabove
Correct
answer:
d
EverySASfileisstoredinaSASdatalibrary,whichisacollectionofSASfiles,suchas
SASdatasetsandcatalogs.Insomeoperatingenvironments,aSASdatalibraryisaphysical
collectionoffiles.Inothers,thefilesareonlylogicallyrelated.IntheWindowsandUNIX
environments,aSASdatalibraryistypicallyagroupofSASfilesinthesamefolderor
directory.
Chapter2:
ReferencingFilesandSettingOptions
1.Ifyousubmitthefollowingprogram,howdoestheoutputlook?
optionspagesize=55nonumber;
proctabulatedata=clinic.admit;
classactlevel;
varageheightweight;
tableactlevel,(ageheightweight)*mean;
6
run;
optionslinesize=80;
procmeansdata=clinic.heartminmaxmaxdec=1;
vararterialheartcardiacurinary;
classsurvivesex;
run;
a.ThePROCMEANSoutputhasaprintlinewidthof80characters,butthePROC
TABULATEoutputhasnoprintlinewidth.
b.ThePROCTABULATEoutputhasnopagenumbers,butthePROCMEANSoutput
haspagenumbers.
c.EachpageofoutputfrombothPROCstepsis55lineslongandhasnopagenumbers,
andthePROCMEANSoutputhasaprintlinewidthof80characters.
d.ThedatedoesnotappearonoutputfromeitherPROCstep.
Correct:
answer:
c
Whenyouspecifyasystemoption,itremainsineffectuntilyouchangetheoptionorend
yourSASsession,sobothPROCstepsgenerateoutputthatisprinted55linesperpagewith
nopagenumbers.Ifyoudon'tspecifyasystemoption,SASusesthedefaultvalueforthat
systemoption.
2.Inorderforthedatevalues05May1955and04Mar2046tobereadcorrectly,whatvaluemust
theYEARCUTOFF=optionhave?
a.avaluebetween1947and1954,inclusive
b.1955orhigher
c.1946orhigher
d.anyvalue
Correct
answer:
d
Aslongasyouspecifyaninformatwiththecorrectfieldwidthforreadingtheentiredate
value,theYEARCUTOFF=optiondoesn'taffectdatevaluesthathavefour-digityears.
3.Whenyouspecifyanengineforalibrary,youarealwaysspecifying
a.thefileformatforfilesthatarestoredinthelibrary.
7
b.theversionofSASthatyouareusing.
c.accesstoothersoftwarevendors'files.
d.instructionsforcreatingtemporarySASfiles.
Correct
answer:
a
ASASengineisasetofinternalinstructionsthatSASusesforwritingtoandreadingfrom
filesinaSASlibrary.Eachenginespecifiesthefileformatforfilesthatarestoredinthe
library,whichinturnenablesSAStoaccessfileswithaparticularformat.Someengines
accessSASfiles,andotherenginessupportaccesstoothervendors'files.
4.WhichstatementprintsasummaryofallthefilesstoredinthelibrarynamedArea51?
a.proccontentsdata=area51._all_nods;
b.proccontentsdata=area51_all_nods;
c.proccontentsdata=area51_all_noobs;
d.proccontentsdata=area51_all_.nods;
Correct
answer:
a
ToprintasummaryoflibrarycontentswiththeCONTENTSprocedure,useaperiodto
appendthe_ALL_optiontothelibref.AddingtheNODSoptionsuppressesdetailed
informationaboutthefiles.
5.ThefollowingPROCPRINToutputwascreatedimmediatelyafterPROCTABULATE
output.WhichSASsystemoptionswerespecifiedwhenthereportwascreated?
8
a.OBS=,DATE,andNONUMBER
b.PAGENO=1,andDATE
c.NUMBERandDATEonly
d.noneoftheabove
Correct
answer:
b
Clearly,theDATEandPAGENO=optionsarespecified.Becausethepagenumberonthe
outputis1,eventhoughPROCTABULATEoutputwasjustproduced.Ifyoudon'tspecify
PAGENO=,alloutputintheOutputwindowisnumberedsequentiallythroughoutyourSAS
session.
6.WhichofthefollowingprogramscorrectlyreferencesaSASdatasetnamedSalesAnalysis
thatisstoredinapermanentSASlibrary?
a.datasaleslibrary.salesanalysis;
setmydata.quarter1sales;
ifsales>100000;
run;
b.datamysales.totals;
setsales_99.salesanalysis;
iftotalsales>50000;
run;
c.procprintdata=salesanalysis.quarter1;
varsalessalesrepmonth;
run;
d.procfreqdata=1999data.salesanalysis;
9
tablesquarter*sales;
run;
Correct
answer:
b
Librefsmustbe1to8characterslong,mustbeginwithaletterorunderscore,andcancontain
onlyletters,numbers,orunderscores.Afteryouassignalibref,youspecifyitasthefirst
elementinthetwo-levelnameforaSASfile.
7.Whichtimespanisusedtointerprettwo-digityearvaluesiftheYEARCUTOFF=optionis
setto1950?
a.1950-2049
b.1950-2050
c.1949-2050
d.1950-2000
Correct
answer:
a
TheYEARCUTOFF=optionspecifieswhich100-yearspanisusedtointerprettwo-digityear
values.ThedefaultvalueofYEARCUTOFF=is1920.However,youcanoverridethedefault
andchangethevalueofYEARCUTOFF=tothefirstyearofanother100-yearspan.Ifyou
specifyYEARCUTOFF=1950,thenthe100-yearspanwillbefrom1950to2049.
8.AsssumingyouareusingSAScodeandnotspecialSASwindows,whichoneofthe
followingstatementsisf