x cd /pub/data/sf12000/Tools; %let pgm=agersexh_query1; filename pgm "&pgm..sas"; *---Use the sf1.agersexh data to handle following query: John, MO Dept. of Health needs age by race & Hispanic (state totals), preferably at the following age breakdowns: Under 1 year Age 1-4 Age 5-9 Age 10-14 Age 15-17 Age 18-19 Then by 5-year cohorts from 20 on (20-24, 25-29, etc.) (Debbie Pitts) e-amil msg , 7-1-01 ---; title 'MCDC SF1 Processing Run: Missouri by Age, Race and Hispanic Origin'; *--Save output for web access in html format--; ods html file='/pub/reports/misc/mo/age_by_race_hispanic_for_the_state.html' style=sasweb; libname sf1 '/pub/data/sf12000'; **libname user '/SAS_temp/user'; %macro by5; %do i=20 %to 84 %by 5; %let up=%eval(&i+4); &i - &up = "&i to &up yrs" %end; %mend; proc format; *---Note how easy it is to change to whatever age intervals you want by just tweaking this code-; value age 0 ="Under 1 yr" 1-4="1 to 4 yrs" 5-9="5 to 9 yrs" 10-14="10 to 14" 15-17="15 to 17" 18-19="18 to 19" %by5 85-high="85 and over"; *--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; proc tabulate data= sf1.moagersexh; where hispanic ne ' ' ; **and county='29001'; class age race hispanic ; format age age. ; format hispanic $yesno. race $race.; var Persons; footnote 'Generated by setup in ' 'sf12000/Tools/agersexh_query1.sas' ' Using Data from SF1, MO'; footnote2 'Note: "Other Single Race" Includes Hawaiian and Other Pacific Islanders'; table all='Total' hispanic, (all age),(all='Total' race)*(persons*sum=' '*f=comma9.); run;