x cd /pub/data/sf12000/Tools; %let pgm=agg_over60_mocnty; filename pgm "&pgm..sas"; *--access the special sf1.agersexh table (derived from the p12 tables) to get counts of persons over 60 by race and hispanic by Missouri county--; libname sf1 '/pub/data/sf12000'; footnote 'Report Produced by the Office of Social and Economic Data Analysis'; footnote2 'Under a Contract with the Missouri Census Data Center'; *---Per request from Debbie Pitts, aggregate to persons over age 60 by race and hispanic by county---; proc sql; create table over60r as select county, race, sum(persons) as Over60 from sf1.moagersexh where race ne ' ' and age >= 60 group by county , race; create table over60h as select county, hispanic, sum(persons) as Over60 from sf1.moagersexh where hispanic ne ' ' and age >= 60 group by county , hispanic; data report; set over60r over60h(in=inh rename=(hispanic=hf)); by county; fips=county; format county $mocnty.; format Over60 comma9.; if inh then race='H'; array c White Black Indian Asian Hawn Other MultiRac Hispanic NonHisp; retain White -- NonHisp; if first.county then do over c; c=0; end; length _i_ 8; if inh then if hf='1' then Hispanic + over60; else NonHisp + over60; else do; if race='mr' then _i_=7; else _i_=substr(race,1,1); if _i_ then c = c + over60; end; if last.county then do; over60=Hispanic + NonHisp; output; end; keep County Over60 White -- NonHisp; run; proc print data=report; title 'Persons Age 60+ by Race and Hispanic Origin by Missouri Counties'; title2 'Source: SF1, 2000 Census'; id county; sum _numeric_; run; filename dlmout "&pgm..csv"; %cnvtdlm(setin=report,names=1) run;