Vous êtes sur la page 1sur 6

SASBASECERTIFICATIONQUESTIONSANDANSWERS

PART4OF4
ThefollowingisalistofquestionsthatcanhelpyoutocrackBaseSAScertificationexam.

PreviousThreeParts

Q31.ThefollowingSASprogramissubmitted:
libnamerawdata1'locationofSASdatalibrary'
filenamerawdata2'locationofrawdatafile'
datawork.testdata
infile
inputsales1sales2
run
Whichoneofthefollowingisneededtocompletetheprogramcorrectly?
A.rawdata1
B.rawdata2
C.'rawdata1'
D.'rawdata2'
Answer:B.Sincewehavealreadyinitializedthepathwithafilename,wedonothavetoincludequotation
again.

Q32.ThefollowingSASprogramissubmittedandreads100recordsfromarawdatafile:
datawork.total
infile'filespecification'end=eof
inputname$salary
totsal+salary

run
WhichoneofthefollowingIFstatementswritesthelastobservationtotheoutputdataset?
A.ifend=0
B.ifeof=0
C.ifend=1
D.ifeof=1
Answer:D.EndisasaskeywordwhichwillbecometruewhenSASreadslastrecordofadataset.This
valueyoucannotusedirectlyinyourprogram,sowecreateaaliasnameeof(endoffile),butyoucanname
itanything.EOFwillcarrythesamevalueasinternalvariableEND.Soasweknow1=trueand0=false.if
EOF=1willoutputonlythelastobservation.

Q33.InthefollowingSASprogram,theinputdatafilesaresortedbytheNAMESvariable:
libnametemp'SASdatalibrary'
datatemp.sales
mergetemp.saleswork.receipt
bynames
run
Whichoneofthefollowingresultsoccurswhenthisprogramissubmitted?
A.TheprogramexecutessuccessfullyandatemporarySASdatasetiscreated.
B.TheprogramexecutessuccessfullyandapermanentSASdatasetiscreated.
C.TheprogramfailsexecutionbecausethesameSASdatasetisreferencedforbothreadandwrite
operations.
D.TheprogramfailsexecutionbecausetheSASdatasetsontheMERGEstatementareintwodifferent
libraries.
Answer:B.tempisdeclaredasapermanentlibrarysopermanentdatasetwillbecreated.
Q34.ThecontentsoftwoSASdatasetsnamedEMPLOYEEandSALARYarelistedbelow:

dataemplsal
mergeemployee(in=ine)salary(in=ins)
byname
ifineandins
run

HowmanyobservationareinEMPLSALdataset?
A.4
B.3
c.2
D.1
Answer:A.
RunthefollowingSAScodeandseewhatyougotintheEMPSALdataset:
datasalary
inputname$salary
datalines
Bruce40000
Bruce35000
Dan37000
Dan.

run
dataemployee
inputname$age
datalines
Bruce30
Dan35

run
dataemplsal
mergeemployee(in=ine)salary(in=ins)
byname
ifineandins
run
Q35.ThefollowingSASprogramissubmitted:
datawork.products
Product_Number=5461
Item='1001'
Item_Reference=Item'/'Product_Number
run
WhichoneofthefollowingisthevalueofthevariableITEM_REFERENCEintheoutputdataset?
A.1001/5461
B.1001/5461

C..(missingnumericvalue)
D.Thevaluecannotbedeterminedastheprogramfailstoexecuteduetoerrors.
Answer:D.SincethereisnoconcatenatesymbolbetweenItemandProduct_Number.
Q36.ThefollowingSASprogramissubmitted:
libnamesasdata'SASdatalibrary'
datatest
setsasdata.chemists(keep=job_code)
ifjob_code='chem3'
thendescription='SeniorChemist'
run
ThevariableJOB_CODEisacharactervariablewithalengthof6bytes.
WhichoneofthefollowingisthelengthofthevariableDESCRIPTIONintheoutputdataset?
A.6bytes
B.8bytes
C.14bytes
D.200bytes
Answer:C.Thelengthof'SeniorChemist'is14.
Q37.WhichoneofthefollowingistrueoftheRETAINstatementinaSASDATAstepprogram?
A.Itcanbeusedtoassignaninitialvalueto_N_.
B.ItisonlyvalidinconjunctionwithaSUMfunction.
C.IthasnoeffectonvariablesreadwiththeSET,MERGEandUPDATEstatements.
D.Itaddsthevalueofanexpressiontoanaccumulatorvariableandignoresmissingvalues.
Answer:C.
TheRETAINstatement
isacompiletimeonlystatementthatcreatesvariablesiftheydonotalreadyexist
initializestheretainedvariabletomissingbeforethefirstexecutionoftheDATAstepifyoudonotsupplyan
initialvalue
hasnoeffectonvariablesthatarereadwithSET,MERGE,orUPDATEstatements.

Q38.ThefollowingSASprogramissubmitted:
datawork.test
Title='ATaleofTwoCities,CharlesJ.Dickens'
Word=scan(title,3,',')
run
WhichoneofthefollowingisthevalueofthevariableWORDintheoutputdataset?

A.T
B.of
C.Dickens
D.''(missingcharactervalue)
Answer:D.
Q39.WhichoneofthefollowingistruewhenSASencountersadataerrorinaDATAstep?
A.TheDATAstepstopsexecutingatthepointoftheerror,andnoSASdatasetiscreated.
B.AnoteiswrittentotheSASlogexplainingtheerror,andtheDATAstepcontinuestoexecute.
C.AnoteappearsintheSASlogthattheincorrectdatarecordwassavedtoaseparateSASfileforfurther
examination.
D.TheDATAstepstopsexecutingatthepointoftheerror,andtheresultingDATAsetcontainsobservations
uptothatpoint.
Answer:B.Ifit'sasyntaxerrorthentheAoccurs.
Ifit'sanerrorwithinvaliddatathenBwilloccur.
Ifit'saproblemwithmergingtwoormoredatasets,thenDwilloccur.
Q40.TheSASdatasetEMPLOYEE_INFOislistedbelow:
IDNumberExpenses
2542100.00
3612133.15
2198234.34
2198111.12
ThefollowingSASprogramissubmitted:
procsortdata=employee_info
run
WhichoneofthefollowingBYstatementscompletestheprogramandsortsthedatasequentiallyby
ascendingexpensevalueswithineachascendingIDNUMBERvalue?
A.byExpensesIDNumber
B.byIDNumberExpenses
C.byascending(IDNumberExpenses)
D.byascendingIDNumberascendingExpenses
Answer:B.BydefaultSASwillsortdatainascendingorder.IDNumbershouldbespecifiedbefore
ExpensesaswewantIDNUMBERtobesortedinascending.

ItsYourTurn!
Ifyouwantmetokeepwritingthissite,pleasepostyourfeedbackinthecommentboxbelow.WhileIlove
havingfriendswhoagree,Ionlylearnfromthosewhodon't.Tohiremeforservicesoradvertising,you

maycontactmeatdeepanshu.bhalla@outlook.com

Vous aimerez peut-être aussi