SAS认证考试官方练习题集和校正答案Word下载.docx
《SAS认证考试官方练习题集和校正答案Word下载.docx》由会员分享,可在线阅读,更多相关《SAS认证考试官方练习题集和校正答案Word下载.docx(39页珍藏版)》请在冰豆网上搜索。
$first^name
$birthdatwdateS・;
b.inputrelation
$first_name
$birthdatEmmddyy8・;
Cinputrelation
$birthda:
date9・;
d.inputrelation
$birthdatE:
mmddyyS・;
Correctanswer:
d
AninformalisusedtotranslatethecalendardatetoaSASdatevalue.Thedatevaluesarcintheformoftwo-digitvaluesformonth-dav-vear,sotheMMDDYY8.informalmustbeused.Whenusinganinformatwithlistinput,thecolonmodifier
isrequiredtocorrectlyassociatetheinformalwiththevariablename.
Youcanlearnabout
•informatsinReadingDateandTimeValues
•thecolon-formatmodifierinReadingFree-FormatData.
2.
Arawdatafileislistedbelow.
1——+10——+20
Jose,47,210
Sue,f108
ThefollowingSASprogramissubmittedusingtherawdatafileaboveasinput:
datacmployccstats;
jnscnJNFILEsecernenthcrc>
inputnameSageweight;
run;
Thefollowingoutputisdesired:
1
name
age
weight
Jose
47
210
Sue
•
108
WhichofthefollowingINFILEstatementscompletestheprogramandaccessesthedatacorrectly?
a.
infile
1file-specification1
pad;
b.
*file-spec!
flcation*
dsd;
c.
'
file-spec!
flcatIon'
dlm='
zf;
d.
1file-spedflcation'
missover;
b
ThePADoptionspecificsthatSASpadvariablelengthrecordswithblanks.TheMISS()VERoptionpreventsSASfromreadingpasttheendofthelinewhenreadingfreeformatteddata.Ther)LM=optionspecificsthecommaasthedelimiter;
however,consecutivedelimitersarctreatedasonebydefault.TheDSD
J
optioncorrectlyreadsthedatawithcommasasdelimitersandtwoconsecutivecommasindicatingamissingvaluelikethoseinthisrawdatafilu.
Youcalllcamabout
•thePADoptioninReadingRawDatainFixedFields
•theM1SS()VERoptioninCreatingMultipleObservationsfromaSin^eRecord
•ther)LM=optionandtheDSDoptioninReadingFree-FormatData.
3.Thefollowingprogramissubmitted:
datanumrecords;
infilecardsdlm=\,;
inputagcntlZagcnt2Zagcnt33;
cards;
joncs^brtmnijoncs.spcnccr,brown
■
9
WhatisthevalueforthevariablenamedAgcnc2illthesecondobscn^atioii?
u.Brown
b.Spencer
c.八(missingcharactervalue)
d.Thereisnovaluebecauseonlyoneobservationiscreated・
TheCARDSstatementenablesyoutoreadinstreamdata.AnynumberofconsecutivecommasarcconsideredtobeasingledelimiterasaresultoftheDLM=option,andthelengthofeachvariabledefaultsto8bytes・Therefore,thevaluesjoncsybrownjon^andspencerarcassignedtoAgend,Agcnc2,andAgcnt3,respectively,forthefirstobservation.TherestofthedataontherecordisnotreadbytheINPUTstatementandisnotoutputtothedataset
•theCARDSstatementinCreatingSASDataSetsfromRawData
•thedefaultlengthofvariablesinReadingFree-FormatData.
4.
1——+10——+20——+30——+40——+50
TWOSTORY104021SANDERSROAD$55,850
CONDO215042.5JEANSAVENUE$127,150
datawork.houses;
infile^file-specification\
insertJNPUTstatementhcrc>
WhichoneofthefollowingINPUTstatementsreadstherawdata
filecorrectly?
input
@1
style$8・
+1
sqfeet4・
bedrooms1・
@20
baths3・
street16・
@40
pricedollar8;
style$8
@20baths3・street$16
@40pricedollars・;
input
street$16・
pricedollars・;
cl.
baths3
c
Formattedinputrequiresperiodsaspartoftheinformalname.TheperiodismissingfromthevariablesStyleandStreetinAnswer
b、thevariableBachsillAnswerd、andthevariablePriceinAnswera(whichisalsomissingadollarsigntoreadthevariableStreetasacharactervalue).
YoucanlearnaboutformattedinputandinformatsinReadingRawDatainFixedFields.
5.ThefollowingSASprogramissubmittedatthestartofanewSAS
session:
libnamcsasdacadm
datasasdaca.salcs;
setsasdaca.salcsdara;
profit=cxpcnscs-rc\-cnucs;
procprintdata=salcs;
TheSASdatasetSasdata.Salesdatahastenobsen^ations.Whichoneofthefollowingexplainswhyareportfailstogenerate?
u.TheDATAstepfailsexecution・
b.TheSASdatasetSalesdoesnotexist.