x cd /pub/data/acs2009/Tools; %let pgm=gen_rank_reports; filename pgm "&pgm..sas"; *---generate a series of rank reports based on vintage 2009 ACS data. 10-18: Just the 1-year data for now. jgb, oseda, 10-18-10--; %libname(acs2009); proc format; value popsize 0-99999='< 100,000' 100000-249999='100,000 to 249,999' 250000-499999='250,000 to 499,999' 500000-high='500,000 and over'; run; %macro filter; %mend filter; %macro wrapper(sumlev=,unit=,ids=,rvar=,rvarlab=,ovars=,mtype=,anamelbl=,vintage=09,period=1,n2r=1500); data rankin; set acs2009.usmcdcprofiles; where sumlev="&sumlev" and geocomp='00'; where also state ne '72'; where also totpop ge 100000; %filter %if %lowcase(%substr(&rvar,1,3))=pct %then %do; %let basevar=%substr(&rvar,4); &rvar._moe=&basevar._moe/&basevar * &rvar; format &rvar._moe 6.1; %end; label areaname="&unit" years='Year(s)' &rvar._moe='+/- (90% MOE)' ; keep sumlev areaname &rvar &rvar._moe &ovars years; format areaname $72.; run; proc sort; by years; run; options nodate ; title "U.S. &unit.s Ranked by &rvarlab"; title2 h=1 color=gray "Top &n2r Areas"; footnote h=1 f=arial "Source: Vintage 20&vintage &period.-year ACS Estimates Processed by Mo Census Data Center"; footnote2 .h=1 f=arial "Report Generated on &sysdate by Setup in acs20&vintage./Tools/gen_rank_reports"; **footnote3 .h=1 "Only Areas With at Least 100,000 Total Population Eligible for Inclusion in This Report"; ods pdf file="../rankreports/us&unit.s&rvar&vintage&period" style=sasweb notoc; %rankrpt(setin=rankin, rankvar=&rvar, n2rank=&n2r, idvars=Areaname &ids, othvars=&rvar._moe &ovars, byvars=years, univvar=totpop,minuniv=100000, prntopts=label, debug=0); run; ods pdf close; %mend wrapper; options mprint; /* ========================begin comment==================================== %wrapper(sumlev=040,unit=State,rvar=pctpoor,ovars=pctpoorunder18 pctpoorover65 totpop,rvarlab=Percent Poor); ==========================end comment====================================== */ %macro filter; if index(areaname,', PR') then delete; %mend filter; %wrapper(sumlev=310,unit=CBSA,rvar=pctpoor,ovars=pctpoorunder18 pctpoorover65 totpop,rvarlab=Percent Poor,n2r=100);