资源描述:
《Frequently Asked Questions about SAS® Indexes》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、SUGI30ApplicationsDevelopmentPaper008-30®FrequentlyAskedQuestionsaboutSASIndexesBillyClifford,SASInstitute,Inc.,Cary,NCABSTRACTIndexesintheBASEenginehavebeenpartofBaseSASsinceSAS6.Overtheyearstheuseandmis-useofindexeshasgeneratedanumberofquestionsfromusers.Theanswerstot
2、hesequestionsmighthelpyouunderstandmoreaboutindexesandhowtheyinteractwithotherSAScomponents.ThispaperbeginswithanoverviewofindextechnologyusedbytheBASEengineandhowSASusestheseindexes.Then,asetofFrequentlyAskedQuestions(FAQs)collectedfromcustomers,in-houseusers,andTechSu
3、pportisanswered,alongwiththerationalefortheanswer.WHATISANINDEX?Anindexisanauxiliarydatastructurethatprovidesfastaccesstoobjectsbyvalue.Allthedataintheindexisredundantandisderivedfromthedataset.It’stheorganizationofthisredundantdatathatprovidestheperformancebenefit.With
4、outanindex,anyoperationthatsubsetsthedata,suchasaWHEREexpression,mustsearcheveryobservationinthedatasetsequentially,lookingformatchingcriteria.Theuseofanindexcansignificantlyreducethetimetolocatethedesiredsubsetofobservations,especiallyifthesubsetissmallcomparedtotheent
5、iredataset.Youcancreateanindexforoneormorevariablesofthedataset.Ifmultiplevariablesarespecified,thevaluesofeachvariableareconcatenatedintheorderspecified,toformtheindexedvalue.Anindexthathasonevariableiscalledasimpleindex.Anindexthathasmultiplevariablesiscalledacomposit
6、eindex.Unlessspecificallymentioned,thispaperdoesnotdistinguishbetweenasimpleindexandacompositeindex.Youcancreatemultipleindexesforthesamedataset.Allindexesforagivendatasetarestoredinasinglefilethatisassociatedwiththedataset.Whenthedatasetisupdatedbyaddingobservations,de
7、letingobservations,orchangingvariablevalues,theindexesareautomaticallyupdated.HOWISANINDEXSTRUCTURED?Thevaluesforanindexedvariablearestoredinaninvertedtreestructure,whichissimilartothediagramshowninFigure1.Eachleafnodecontainsasetofvalue/RIDpairsthatareorderedbyvalue.Th
8、eRID,orRecordIdentifier,isusedtolocatetheobservationondiskthatcontainsthevalue.Allleafnodes,asaunit,formanorde