x cd /pub/data/sf12000/Tools; %let pgm=agersexh_query2; filename pgm "&pgm..sas"; *---Use the sf1.agersexh data to handle following query: For Marie Dargan St. Louis County Municipal Courts 314 615-4535 Want breakdown of persons aged 10-17 by race for municipalities and unincorporated areas in St. Louis county. Rev. Oct. 2002 now want persons 10-16 ---; title "MCDC SF1 Processing Run: &pgm : Population Aged 10-16 by Race by Municipality for St. Louis County"; options linesize=160; *--Save output for web access in html format--; ods html file="/pub/reports/temp/dargan.html"; libname sf1 '/pub/data/sf12000'; libname user '/SAS_temp/user'; proc format; *--yesno will be used with the hispanic dimension variable-; value $yesno '0'='No' '1'='Yes'; value $race '1w'='White alone' '2b'='Black alone' '3i'='Amer Indian alone' '4a'='Asian alone' /* '5h'='Hawaiian + Other Pac Islandrs' --comment out so these get collapsed into other group */ 'mr'='Multi-race' other='Other single race'; run; options missing='0'; *<---so the cells with no data print as 0's instead of .'s--; options nodate; data &pgm; set sf1.moagersexh; *--select st. louis county observations with race/hispanic detail--; where county='29189' and hispanic ne ' ' ; *--define the at risk category/ analysis variable--; if 10 <= age <= 16 then AtRisk=1; else AtRisk=0; length City $16; city=placefp; if placefp='99999' then city='Unincorporated'; keep race hispanic atrisk city persons; run; proc tabulate data= &pgm; freq Persons; class race hispanic City; format hispanic $yesno. race $race.; format city $mofplace.; var AtRisk; table all='Total' hispanic, all='St. Louis co. totals' City, (all='Total' race)*(AtRisk="At Risk" *(sum='Persons'*f=comma9. mean='%'*f=percent7.1)); footnote 'Generated by setup in ' 'sf12000/Tools/agersexh_query2.sas' ' Using Data from SF1, MO'; footnote2 'Note: "Other Single Race" Includes Hawaiian and Other Pacific Islanders'; run; ods html close;