欢迎来到天天文库
浏览记录
ID:39766387
大小:89.42 KB
页数:5页
时间:2019-07-11
《The Mystery of the PROC SORT Options NODUPRECS and》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、SUGI30Coders'CornerPaper037-30TheMysteryofthePROCSORTOptionsNODUPRECSandNODUPKEYRevealedBrittaKelsey,MGIPharma,Inc.,Bloomington,MNABSTRACTTheNODUPRECS(orNODUP)andNODUPKEYoptionscanbeusefulwiththeSORTprocedurebuttheycanbedangerousifyoudonotunderstandthemcompletely
2、.Theyworksimilarlyinthattheybothcaneliminateunwantedobservations,butNODUPRECScomparesallthevariablesinyourdatasetwhileNODUPKEYcomparesjusttheBYvariables.Also,youmustbeawareofhowyourdatasetiscurrentlysortedtoeliminatetheobservationsthatyouwantbecausetheseoptionsco
3、mpareadjacentobservations.Inthispaper,IwilldescribethisingreaterdetailandshowexamplesofhowtousetheNODUPRECSandNODUPKEYoptions.AllexamplesshownweredoneintheSAS®systemforPCs,version8.2.TheintendedaudienceforthispaperisbeginnerlevelSASprogrammers.INTRODUCTIONTherese
4、emstobeconfusionamongSASusersabouttheNODUPRECS(orNODUP)andNODUPKEYoptions.Thesecanbeveryusefulbutdangerousifyouarenotclearonhowtheywork.IwillbringsomeclarificationtothesePROCSORToptionsandwillshowsomeexamplesofhowtheyworksoyoucanputthemtogooduse.Throughouttherest
5、ofthispaperIwillbeusingthealiasNODUPfortheNODUPRECSoption.DEFININGNODUPANDNODUPKEYOPTIONSTheNODUPoptionchecksforandeliminatesduplicateobservations.Ifyouspecifythisoption,PROCSORTcomparesallvariablevaluesforeachobservationtothoseforthepreviousobservationthatwaswri
6、ttentotheoutputdataset.Ifanexactmatchisfound,theobservationisnotwrittentotheoutputdataset.TheNODUPKEYoptionchecksforandeliminatesobservationswithduplicateBYvariablevalues.Ifyouspecifythisoption,PROCSORTcomparesallBYvariablevaluesforeachobservationtothoseforthepre
7、viousobservationwrittentotheoutputdataset.IfanexactmatchusingtheBYvariablevaluesisfound,theobservationisnotwrittentotheoutputdataset.NoticethatwiththeNODUPKEYoption,PROCSORTiscomparingallBYvariablevalueswhiletheNODUPoptioncomparesallthevariablesinthedatasetthatis
8、beingsorted.Aneasywaytorememberthedifferencebetweentheseoptionsistokeepinmindtheword“key”inNODUPKEY.Itevaluatesthe“key”orBYvariablevaluesthatyouspecify.Onethin
此文档下载收益归作者所有