资源描述:
《How Many Observations Are In My Data Set》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、Paper95-26HowManyObservationsAreInMyDataSet?JackHamilton,FirstHealth,WestSacramento,CaliforniaABSTRACTNOBS=DOESN’TWORKWITHADATASTEPVIEWThispaperpresentsamacrowhichreturnsthenumberofTheNOBS=optionalsodoesn’tworkwithadatastepview:observationsinaSASdatasetorview,withanoptionalWHEREclause,anda
2、nadditionalmacrowhichindicatesonlywhetherthedatadatav1/view=datav1;datasetorviewisempty.setrow1col1;run;data_null_;INTRODUCTIONputnobs=;ItsometimeshappensthataSASprogramneedstoknowhowstop;manyobservationsareinaSASdataset.Thetraditional,andsetdatav1nobs=nobs;fastest,methodistousetheNOBS=opt
3、iononaSETstatement,run;butthismethoddoesnotalwaysreturnthecorrectnumber.ThispaperdescribessomeoftheproblemswiththeNOBS=solution,printsandpresentsamacroasanalternativesolution.NOBS=WORKSWITHANORDINARYDATASETNOBS=2147483647Supposeyouhaveanordinarydataset,onethatyou’vejustcreated:Plausible,if
4、youhappentohaveareallylargedataset,butincorrect.datarow1col1;a=12;NOBS=DOESN’TWORKINVARIOUSOTHERCASESoutput;NOBS=alsodoesn’tworkwithtransportdatasets,SQLviewsrun;(includingdatabasepassthroughviews),andinsomeothercases.IfyouusetheNOBS=optiononaSETstatement,youcanfindSOWHAT?thenumberofobserv
5、ationsinthedataset:UseoftheNOBS=optionisOKifyoujustcreatedthedatasetearlierinthesameprogram,orifyouhavesomeotherwayofdata_null_;knowingforcertainhowthedatasetwascreatedandpossiblyputnobs=;modified..stop;setrow1col1nobs=nobs;Ontheotherhand,ifyoudon’tknowhowthedatasetwasrun;createdorhowitmig
6、hthavebeenmanipulated,it’snotsafetouseNOBS=.Inparticular,ifyou’rewritingageneralpurposeprintsprogramormacrothatmightbeusedbyanyoneonanarbitrarydataset,youshouldnotuseNOBS=tocountobservations.NOBS=1Thisproblemwasnotobviousinthepast,whenviewsandTHEPROBLEMtransportdatasetsweren’tcommon.Butthe
7、sedays,adatasetmightcomefromanywhere–youmightbedealingwitha“real”TheproblemisthattheNOBS=optiondoesn’tproducecorrectdataset,oraview,oranexternaldatabase,orarealdatasetonresultsforalltypesofdatasets.adifferentplatform.NOBS=DOESN’TWORKWITHANEDITEDDATASETAdataset