x cd /mscdc/sas/formats/Tools; %let pgm=zipmetr; filename pgm "&pgm..sas"; *--Create a revised ZIP-metro format code relating ZIPs to metro area codes as of 6/95. Makes use of the $zipcnty and $comet95_ formats. Sponsored by IBM (Bruce Fogarty), 9-96, jgb-----*; filename formats '/mscdc/sasfmats'; libname fmatlib '/mscdc/sasctlgs'; *<===This is where we keep our permanent SAS formats in the formats catalog on the oseda box-; filename text '/mscdc/sas/formats/Szipmetr.sas'; *<--we re-write this file with invocation of genfmat macro--; *--we had to edit the comet94 module because it was returning M as mtype in New England. Manually edited, now recompile it. We also do come95 in case.; proc format library=fmatlib; *include formats('Scomet94_.sas'); %include formats('Scomet95.sas'); run; *--begin with the zip-county list as a dataset and use comet95_ to assign metro code--; proc format library=fmatlib cntlout=zipcnty; select $zipcnty; run; data zipmetro; set zipcnty; if hlo=' '; length izip ilo ihi 8 zip $5 county $5 metro $5; county=substr(label,1,5); metro=put(county,$comet95_.); if county=metro then metro=' '; *<---zip not in a metro area-; ilo=start; ihi=end; do izip=ilo to ihi; if izip=ilo then zip=start; else zip=put(izip,z5.); OUTPUT; end; keep zip county metro; run; %genfmat(fmatname=zipmetr, savedoc=1, sasin=zipmetro,argvars=zip,arglen=5,intrvls=1, labelvar=metro,labellen=5,runproc=1)