SAS认证考试(官方练习题集和校正答案)_第1页
SAS认证考试(官方练习题集和校正答案)_第2页
SAS认证考试(官方练习题集和校正答案)_第3页
SAS认证考试(官方练习题集和校正答案)_第4页
SAS认证考试(官方练习题集和校正答案)_第5页
已阅读5页,还剩35页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1.Arawdatafileislisted

below.

sonFrank01/31/89

daughterJune12-25-

87

brotherSamuel01/17/51

Thefollowingprogramis

submittedusingthisfileas

input:

datawork.family;

infile'file-

specification';

<insertINPUT

statementhere>

run;

WhichINPUTstatement

correctlyreadsthevaluesfor

thevariableBirthdateas

SASdatevalues?

a.inputrelation

$first_name

$birthdatedate9.;

b.inputrelation

$first_name

$birthdate

mmddyy8.;

C.inputrelation

$first_name

$birthdate:

date9.;

d.inputrelation

$first_name

$birthdate:

mmddyy8.;

[^Correctanswer:F§1d

AninformatisusedtotranslatethecalendardatetoaSASdate

value.Thedatevaluesareintheformoftwo-digitvaluesfor

month-day-ycar,sotheMMDDYY8.informalmustbeused.

Whenusinganinformatwithlistinput,thecolon-format

modifierisrequiredtocorrectlyassociatetheinformatwiththe

variablename.

Youcanlearnabout

•informatsin「0ReadingDateandTimeValues

•thecolon-formatmodifierinReadingFree-Forniat

Data.

度A

百2・Arawdatafileislistedbelow.

Jose,47,210

Sue,,108

ThefollowingSASprogramissubmittedusingtherawdatafile

aboveasinput:

dataemployeestats;

<insertINFILEstatementhere>

inputname$ageweight;

run;

Thefollowingoutputisdesired:

nameageweight

Jose47210

Sue•108

WhichofthefollowingINFILEstatementscompletesthe

programandaccessesthedatacorrectly?

4.infile*file-specification'pad;

b.infile1file-specification'dsd;

C.infile*file-specification1dlm=',*;

d.infile1file-specification,missover;

百Correctanswer:府b

ThePADoptionspecifiesthatSASpadvariablelengthrecords

withblanks.TheMISSOVERoptionpreventsSASfrom

readingpasttheendofthelinewhenreadingfreeformatted

data.TheDLM=optionspecifiesthecommaasthedelimiter;

however,consecutivedelimitersarctreatedasonebydefault.

TheDSDoptioncorrectlyreadsthedatawithcommasas

delimitersandtwoconsecutivecommasindicatingamissing

valuelikethoseinthisrawdatafile.

Youcanlearnabout

•thePADoptionin&ReadingRawDatainFixed

Fields

•theMISSOVERoptionin@CreatingMultiple

ObservationsfromaSingleRecord

•theDLM=optionandtheDSDoptionin/Reading

Free-FormatData.

垣人

百3・Thefollowingprogramissubmitted:

datanumrecords;

infilecardsdlm=',';

inputagentl$agent2$agent3$;

cards;

jones,,brownjones,spencer,brown

run;

WhatisthevaluefbrthevariablenamedAgent2inthesecond

observation?

a.Brown

b.Spencer

c.''(missingcharactervalue)

d.Thereisnovaluebecauseonlyoneobservationis

created.

存Correctanswer:百d

TheCARDSstatementenablesyoutoreadinstreamdata.Any

numberofconsecutivecommasareconsideredtobeasingle

delimiterasaresultoftheDLM=option,andthelengthofeach

variabledefaultsto8bytes.Therefore,thevaluesjones,

brownjon,andspencerareassignedtoAgentl,Agent2,and

Agents,respectively,forthefirstobservation.Therestofthe

dataontherecordisnotreadbytheINPUTstatementandisnot

outputtothedataset.

Formattedinputrequiresperiodsaspartoftheinfonnatname.

Theperiodismissingfromthevariablesstyleandstreetin

Answerb,thevariableBa:hsinAnswerd,andthevariable

PriceinAnswera(whichisalsomissingadollarsigntoread

thevariablestreetasacharactervalue).

Youcanlearnaboutformattedinputandinformatsin

aReadingRawDatainFixedFields.

臣d

百5・ThefollowingSASprogramissubmittedatthestartofanew

SASsession:

libnamesasdata'SAS-data-library';

datasasdata.sales;

setsasdata.salesdata;

profit=expenses-revenues;

run;

procprintdata=sales;

run;

TheSASdatasetSasdata.Salesdatahastenobservations.

Whichoneofthefollowingexplainswhyareportfailsto

generate?

a.TheDATAstepfailsexecution.

b.TheSASdatasetSalesdoesnotexist.

c.TheSASdatasetSaleshasnoobservations.

d.ThePRINTprocedurecontainsasyntaxerror.

@Correctanswer:飞b

TheDATAstepcreatesapermanentSASdataset,

Sasdata.Salesdata.ThePRINTprocedureisprintinga

temporarySASdataset.Sales,thatisstoredintheWork

library.AtthebeginningoftheSASsession,Work.Salesdoes

notexist.

Youcanlearnabout

•creatingpermanentdatasetswiththeDATAstepin

百CreatingSASDataSetsfromRawData

•temporarydatasetsin0BasicConcepts.

©

々6.WhichactionassignsareferencenamedSALEStoapermanent

SASdatalibrary?

a.Issuingthecommand:

librefSALES1SAS-data-library1

b.Issuingthecommand:

libnameSALES'SAS-data-library'

c.Submittingthestatement:

librefSALES'SAS-data-libraryr;

d.Submittingthestatement:

libnameSALES'SAS-data-library1;

百Correctanswer:衣d

TheLIBNAMEstatementassignsareferenceknownasalibref

toapermanentSASdatalibrary.TheLIBNAMEcommand

openstheLIBNAMEwindow.

YoucanlearnabouttheLIBNAMEstatementin

5ReferencingFilesandSettingOptions.

成7ThefollowingSASprogramissubmitted:

datanewstaff;

setstaff;

〈insertWHEREstatementhere>

run;

WhichoneofthefollowingWHEREstatementscompletesthe

programandselectsonlyobservationswithaHire_dateof

February23,200⑴

a.wherehire_date=*23feb20001d;

b.wherehire_date=*23feb20001;

C,wherehire_date=*02/23/2000'd;

d.wherehire_date=102/23/2000";

百Correctanswer:0a

ASASdateconstantmusttaketheformofone-ortwo-digit

day,three-digitmonth,andtwo-orfour-digityear,enclosedin

quotationmarksandfollowedbyad('ddmmmyy<yy>'d).

YoucanlearnaboutSASdateconstantsinrecreatingSAS

DataSetsfromRawData.

百8・WhichoneofthefollowingSASdateformatsdisplaystheSAS

datevalueforJanuary16,2002intheformof16/01/2002?

a.DATE10.

b.DDMMYY10.

c.WEEKDATE10.

d.DDMMYYYY10.

府Correctanswer:我b

Therequestedoutputisinday-monlh-yearorderandis10bytes

long,soDDMMYY10.isthecorrectformat.Although

WEEKDATE10.isavalidSASformat,itdoesnotdisplaythe

SASdatevalueasshowninthequestionabove.

DDMMYYYY10.isnotavalidSASdateformat,andthe

DATEvv.formatcannotacceptalengthof10.

Youcanlearnabout

•theDDMMYY10.formatineCreatingListReports

•theWEEKDATE10.formatin10ReadingDateand

TimeValues.

匝d

百9・Whichoneofthefollowingdisplaysthecontentsofanexternal

filefromwithinaSASsession?

a.theLISTprocedure

h.thePRINTprocedure

c.theFSLISTprocedure

d.theVIEWTABLEwindow

Correctanswer:存c

ThePRINTprocedureandVIEWTABLEwindowdisplaythe

valuesinSASdatasets.TheFSLISTproceduredisplaysthe

valuesinexternalfiles.ThereisnoLISTprocedureinSAS.

Youcanicarnabout

•thePRINTprocedurein[^CreatingListReports

•theVIEWTABLEwindowin[^ReferencingFilesand

SettingOptions.

叵A

百10・TheSASdatasetSashelp.Prdsalecontainsthevariables

RegionandSalarywith4observationsperRegion.

Sashelp.PrdsaleissortedprimarilybyRegionandwithin

RegionbySalaryindescendingorder.

Thefollowingprogramissubmitted:

dataone;

setsashelp.prdsale;

retaintemp;

byregiondescendingsalary;

iffirst.regionthen

do;

temp=salary;

output;

end;

iflast.regionthen

do;

range=salary-temp;

output;

end;

run;

Foreachregion,whatisthenumberofobservation(s)writtento

theoutputdataset?

a.0

b.1

c.2

d.4

百Correctanswer:百c

Theexpressionfirst.regionistrueonceforeachregion

group.Theexpressionlast.regionistrueonceforeachregion

group.Therefore,eachOUTPUTstatementexecutesoncefora

totalof2observationsintheoutputdataset.

YoucanlearnabouttheHRST.variableexpressionandthe

OUTPUTstatementinGReadingSASDataSets.

咫ILThefollowingSASprogramissubmitted:

proccontentsdata=sasuser.houses;

run;

Theexhibitbelowcontainspartialoutputproducedbythe

CONTENTSprocedure.

|DataSetNameSASUSER.HOUSESObservations15

(MemberTypeDATAVariables6

(EngineV9Indexes0

Tuesday,April22,Observation

Created56

200303:09:25PMLength

Tuesday,April22,Deleted

LastModified0

200303:09:25PMObservations

|ProtectionCompressedNO

|DataSetTypeSortedNO

Residentialhousing

Label

forsale

Data

WINDOWS_32

Representation

wlatinlWestern

Encoding

(Windows)

WhichofthefollowingdescribestheSasuser.Housesdataset?

a.Thedatasetissortedbutnotindexed.

b.Thedatasetisbothsortedandindexed.

c.Thedatasetisnotsortedbutisindexed.

d.Thedatasetisneithersortednorindexed.

@Correctanswer:qd

TheexhibitaboveshowspartialoutputfromtheCONTENTS

procedure,Inthetopright-handcolumnoftheoutput,yousee

thatindexeshasavalueof0,whichindicatesthatnoindexes

existforthisdataset.Also,sortedhasavalueofNO,which

indicatesthatthedataisnotsorted.

YoucanlearnabouttheCONTENTSprocedurein

GReferencingFilesandSettingOptions.

r§~12.ThefollowingSASprogramissubmitted:

procsortdata=work.test;

byfnamedescendingsalary;

run;

Whichoneofthefollowingrepresentshowtheobscrvaiionsarc

sorted?

a.ThedatasetWork.Testisstoredinascendingorderby

bothFnameandSalaryvalues.

b.ThedatasetWork.Testisstoredindescendingorderby

bothFnameandSalaryvalues.

c.ThedatasetWork.Testisstoredindescendingorderby

fnameandascendingorderbysalaryvalues.

d.ThedatasetWork.Testisstoredinascendingorderby

FnameandindescendingorderbySalaryvalues.

府Correctanswer:百d

TheDESCENDINGkeywordisplacedbeforethevariablename

itmodifiesintheBYstatement,sothecorrectdescriptionisin

descendingorderbySalaryvaluewithinascendingFname

values.

YoucanlearnabouttheSORTj?roccdurcandthe

DESCENDINGkeywordinf^ScreatingListReports.

度A

布3.ThefollowingSASprogramissubmitted:

datanames;

title=,EDU,;

iftitle='EDU'then

Division=*Education';

elseiftitle=*HR'then

Division=*HumanResources,;

elseDivision—'Unknown';

run;

Whichoneofthefollowingrepresentsthevalueofthevariable

Divisionintheoutputdataset?

a.Educatio

b.Education

c.HumanRe

d.HumanResources

百Correctanswer:百b

ThelengthofthevariableDivisionissetto9whentheDATA

stepcompiles.SincethevalueofthevariableTitleisEDU,the

firstIFconditionistrue;therefore,thevalueofthevariable

DivisionisEducation.

Youcanlearnabout

•thelengthofavariablein/UnderstandingDATA

StepProcessing

•IF-THENstatementsin[^CreatingandManaging

Variables.

匝d

存14.WhichoneofthefollowingSASprogramscreatesavariable

namedcitywithavalueofChicago?

a.datawork.airports;

AirportCode='ord';

ifAirportCode=*ORD1City=*Chicago,;

run;

b.datawork.airports;

AirportCode=*ORD*;

ifAirportCode='ORD1City=*Chicago';

run;

C.datawork.airports;

AirportCode=1ORD*;

ifAirportCode=*ORD'thenCity='Chicago';

run;

d.datawork.airports;

AirportCode=*ORD,;

ifAirportCode='ORD';

thenCity=*Chicago,;

run;

百Correctanswer:飞c

ThecorrectsyntaxforanIF-THENstatementis:IFexpression

THENstatement',

Inthisexample,thevariablecityisassignedavalueof

ChicagoonlyiftheexpressionAirportCode=*ORD'istrue.

YoucanlearnaboutIF-THENstatementsinCreatingand

ManagingVariables.

匝d

存15.ThefollowingSASprogramissubmitted:

datawork.building;

code=1DAL523';

code=1SANFRAN6041;

lengthcode$20;

run;

Whichoneofthefollowingisthelengthofthecodevariable?

a.6

b.7

c.10

d.20

回Correctanswer:0a

TheDATAstepfirstgoesthroughacompilationphase,thenan

executionphase.Thelengthofavariableissetduringthe

compilationphaseandisbasedonthefirsttimethevariableis

encountered.Inthiscase,thevariablecodeissettothelength

ofthetextstringDAL523whichis6characterslong.Thenext

assignmentstatementsareignoredduringcompilation.The

LENGTHstatementisalsoignoredsincethelengthhasalready

beenestablished,butanotewillbewrittentothelog.

Youcanlearnabout

•thecompilationphaseoftheDATAstepin

UnderstandingDATAStepProcessing

•theLENGTHstatementin<5CreatingandManaging

Variables.

皮d

<516.Whichofthefollowingstatementscreatesanumericvariable

namediDnumberwithavalueof4198?

&IDnumber=4198;

b.IDnumber=*4198*;

c.lengthIDnumber=8;

d.lengthIDnumber$8;

百Correctanswer:0a

ThefirstreferencetotheSASvariableintheDATAstepsets

thename,type,andlengthofthevariableintheprogramdata

vector(PDV)andintheoutputSASdataset.Theassignment

statementiDnumber=4i98;isthefirstreferenceandcreatesa

numericvariablenamedIDnumberwithadefaultstoragelength

of8bytes.

Youcanlearnabout

•creatingvariablesintheDATAstepin

UnderstandingDATAStepProcessing

•numericvariablesinyBasicConcepts.

皮▲

咫17・Thefollowingprogramissubmitted:

datafItaten;

inputjobcode$salaryname$;

cards;

FLAT170000Bob

FLAT260000Joe

FLAT330000Ann

run;

datadesc;

setfItaten;

ifsalary>60000thendescription=*Over60';

elsedescription='Under6U*;

run;

Whatisvalueofthevariablenameddescriptionwhenthe

valueforsalaryis30000?

a.Under6

b.Under60

c.Over60

d.''(missingcharactervalue)

r^Correctanswer:苞a

Thevariabledescriptionisbeingcreatedbythe1F-

THEN/ELSEstatementduringcompilation.Thefirstoccurrence

ofthevariabledescriptionisontheIFstatement,andsinceit

isassignedthevalueOver60,thelengthofthevariableis7.

Therefore,forthesalaryvalueof30000,descriptionhasthe

valueofUnder6(the0istruncated.)

Youcanlearnabout

•thecompilationphaseoftheDATAstepin

UnderstandingDATAStepProcessing

•IF-THEN/ELSEstatementsin专Creatingand

ManagingVariables.

咫18・Arawdatafileislistedbelow.

1—-+10--+2C——一+

To^

23~

20

15

Thefollowingprogramissubmitted:

dataall_sales;

infile'file-specification’;

inputreceipts;

<insertstatement(s)here>

run;

Whichstatement(s)complete(s)theprogramandproduce(s)a

runningtotaloftheReceiptsvariable?

total+receipts;

b.total0;

sumtotal;

c.total=total+receipts;

&total=sum(total,receipts);

存Correctanswer:百a

TheSUMfunctionandtheassignmentstatementdonotretain

valuesacrossiterationsoftheDATAstep.Thesumstatement

total+receipts;initializestotalto0,ignoresmissingvalues

ofreceipt,retainsthevalueoftotalfromoneiterationtothe

next,andaddsthevalueofreceiptstototal.

Youcanlearnaboutthesumstatementin&Creatingand

ManagingVariables.

©A

百19.Arawdatafileislistedbelow.

ThefollowingSASprogramissubmittedandreferencestheraw

datafileabove:

datamoney;

infile'file-specification';

inputyearquantity;

total=total+quantity;

run;

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论