x cd /mscdc/data/georef/Tools; %let pgm=georef.uscntys; filename pgm "&pgm..sas"; *--create a reference dataset and a report showing all counties in the U.S. as of 7-1-94 with metro area codes--; %libname(usaco94) libname georef '/mscdc/data/georef'; filename refrept '/mscdc/data/georef/uscntys.listing'; options nodate ls=132 ps=59; data georef.uscnty94(label='Counties and labels from usaco94' sortedby=state county ); length fipco $5 state $2 cnty $3; set usaco94.uscntys(keep=state county areaname slvl msacmsa pmsa stab); where slvl='050'; fipco=county; cnty=substr(fipco,3,3); *<--just a standard; length cntyfnam $40; cntyfnam=put(county,$fipcnty.); format county $fipcnty16.; drop cntyfnam; length metronm $40; label metronm='Metro Area Name'; if pmsa ne ' ' then metronm=put(pmsa,$pmsa94_.); else if msacmsa ne ' ' then metronm=put(msacmsa,$metro94_.); if county=cntyfnam then put / _all_ " *** format problem *** "; else output; run; proc contents data=georef.uscnty94; title 'georef.uscnty94'; run; proc print data=georef.uscnty94(obs=40); title2 'First 40 Observations'; run; proc printto print=refrept new; options pageno=1 ls=120 ps=118; proc print u data=georef.uscnty94; by state ; id fipco county stab; var areaname msacmsa pmsa metronm; title 'Listing of georef.uscnty94: County Codes and Names ' '(Extracted from usaco94.uscntys Dataset)'; footnote 'This Report Stored in ' '/mscdc/data/georef/uscntys.ref.listing'; run;