x cd /pub/data/dpro2010/Tools; %let pgm=raceh_report; filename pgm "&pgm..sas"; *---Genreate detailed breakdown by age. Shows 5 major cohorts 3 measures each. Macro used allows you to specify the state and the geographic units. jgb, 5-23-11 ---; %libname (dpro2010); options ls=160; options nodate; *******footnote h=1 "Report from the Mo Census dpsfata Center Using 2010 dpsfemographic Profiles dpsfata"; ods listing close; %macro doit(state,stab); title color=brown "Basic Race and Hispanic Population Report for &statenm"; footnote h=1 'All percentages use Total Pop as the denominator'; footnote2 h=1 "Report generated by MO Census Data Center on &sysdate from setup in &pgm..sas in dpro2010/Tools using acs2010.&stab.pros data"; ods html file="/pub/reports/raceh_2010census/&statenm..html"; options orientation=landscape; ods pdf file="/pub/reports/raceh_2010census/&statenm..pdf"; data report ; set dpro2010.&stab.pros; where geocomp='00' and pop100; TotPop=pop100; if sumlev='060' then do; length _cntyname $40; _cntyname=put(county,$county.); %chopwrd(_cntyname); Areaname=trim(_cntyname)|| ' Co. - '||Areaname; end; %macro race(r,cell); &r=dpsf8i&cell; pct&r=100*&r/TotPop; %mend race; %race(White,3) %race(Black,4) %race(Asian,6) %race(Indian,5) %race(HawnPI,14) %race(Other,19) %race(MultiRace,20) Hispanic=dpsf10i2; pctHispanic=100*Hispanic/Totpop; PctMexican=100*dpsf10i3/totpop; PctPR=100*dpsf10i4/totpop; PctCuban=100*dpsf10i5/totpop; PctOtherHisp=100*dpsf10i6/totpop; WhiteNH= dpsf11i11; PctWhiteNH=100*WhiteNH/totpop; if "&state"="00" then state="00"; *<===weird stuff with national file---; keep state sumlev areaname TotPop--pctWhiteNH ; label sumlev='Geographic Unit(s)' areaname='Geographic/Area'; format _numeric_ comma9. pct: 5.1 totpop comma11.; run; proc sort; by state sumlev areaname; run; proc report data=report nofs headskip split='/' style(header)=[background=gray foreground=white font_face=helvetica font_weight=bold font_size=2] style(column)=[background=white foreground=black font_face=helvetica font_weight=bold font_size=2]; by sumlev; format sumlev $sumlev.; cols areaname TotPop ("Single Race" ("White" white pctwhite) ("Black" black pctblack) ("American/Indian, etc" indian pctindian) ("Asian" asian pctasian) ("Ntv Hawn/Other Pac.I." hawnpi pcthawnpi) ("Other/Race" other pctother) ) ("Multi/Racial" MultiRace pctMultirace) ("Hispanic/or Latino" hispanic pcthispanic) ("White/Nonhispanic" whitenh pctwhitenh); define areaname /id display style(column)=[foreground=white background=#6699cc font_weight=bold font_face=arial] style(header)=[foreground=white background=gray]; define areaname / display flow ; define totpop / display "Total/Pop"; %macro defs(var); define &var /display '#'; define pct&var/ display '%'; %mend defs; options mprint; %defs(white) %defs(black) %defs(indian) %defs(asian) %defs(hawnpi) %defs(other) %defs(multirace) %defs(hispanic) %defs(whitenh) run; ods html close; ods pdf close; %mend doit; %*dostates(10,names=1); /* ==========================================begin comment================================== %dostates(11 12 21 23 25 26 28 35 38 44 45 47 54,names=1,msgs=1); %dostates(02 04 06 09 13 16 27 30 33 36 39 72 55,names=1,msgs=1); %dostates(01 08 10 15 20 29 31 32 37 42 49 53 56,names=1); %dostates(05 17 18 19 22 24 34 40 41 46 48 50 51 ,names=1); %let statenm=%str(United States); %doit(00,us) =========================================end comment======================================= */ %dostates(34,names=1)