资源描述:
《Yes, We Can... Save SAS® Formats》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、SASGlobalForum2012Coders'CornerPaper048-2012®Yes,WeCan...SaveSASFormatsJohnLadds,StatisticsCanada,Ottawa,Ontario,CanadaABSTRACT®IfyousharetheresultsofyourSASprogramswithanyone;youlikelyuseSASformats.Eachtimeyourunyourprogram,yourecreatetheformats.Thisformatrecreationtake
2、stime,itaddstothelengthofyourlog,theformatsdonotchangeonceyouhavecreatedthemandSASissueswarningsthattheformatsalreadyexist.Nonetheless,youstillcreatethemoverandoveragain.Well,didyouknowthatyoucaneasilycreateyourformatsonce,savethemandthenre-usethemagainandagain?Ifyouaref
3、eelinggenerous,youcanevensharethemwithothers.INTRODUCTIONSASformatsorthemoregenericterm“valuelabels”areusedtomakecodedinformationmoreuser-friendly.Insteadofusingcodes1and2inyourreportsandcharts,ameaningfullabelsuchasMALEandFEMALEorYESandNOtakestheplaceofthecode.Typically
4、,valuelabelsarecreatedatthebeginningofaSASprogramandappliedtoaSASdatasetasitiscreated.Eachtimetheprogramisrun;thevaluelabelsarere-createdandappliedtothedataset.Thistakestimeandaddstothelengthofyourprogramandlogs.Eachsubsequenttimethatyourunyourprogram,SASissuesawarningth
5、attheformatsalreadyexist.Thereisasolution.SASallowsyoutosaveyourformatsinacatalogsoyoucanre-usethemand,ifyouarefeelinggenerous,sharethemwithothers.WHATISASASFORMAT?ASASformatisauser-friendlywayofdisplayingnumericorcharacterdata.Formatsallowyoutoaddmeaningtocodes,groupcod
6、esordatapoints.Formatsalsoletyourecodeandreformatdata.Withoutexplicitvaluelabels,otherusersmustrelyonacodebookordatadictionarytointerpretthedata,thetablesorthechartswithwhichtheyareworking.YoucancreateformatsusingtheFORMATprocedureandyoucanusetheFORMATstatementinadataste
7、ptoconnectavariabletoaformat.PleaseseetheSASOnlineDocumentationformoredetails.HOWTOSAVEAFORMATAllformatsarestoredinacatalog.Acatalogisjustanothertermforacollectionofformats.AnytimeyoucreateoruseSASformats,theygetstoredinacatalog.Ifyoudon’tspecifythecatalog,SASplacesyourf
8、ormatsintheWORKlibraryinacatalogcalledFORMATS.Thesearetemporaryformatscatalogs.Aswitheverythingelseinth