x cd /pub/data/stf901/Tools; %let pgm=careynbhd; filename pgm "&pgm..sas"; /*----------------------------------------------------------------------------------------------------------------- This code aggregates stf901 data from census blocks specified by Ron Carey, Springfield, MO. It creates the temporary dataset careynbhd in the stf901 directory. Coded by John Blodgett, OSEDA, U. of Missouri, blodgettj@umsystem.edu Under contract with the Missouri Census Data Center Revision History: 9.30.02: Coding begins. ------------------------------------------------------------------------------------------------------*/ libname stf901 '/pub/data/stf901'; libname user '/SAS_temp/user'; *<===Optional. Permissions on this directory limit who can use it; title "Generate stf901.&pgm"; options msglevel=i; /*<=========================Comment out===================================== data aggin; length sumlev $3 region $3; set stf901.moblks00; where county='29077'; if tract in ('0001.00','0006.00', '0007.00'); length b 8; b=input(block,4.); drop b ; select (tract); when ('0001.00') if b in (1043,1044,1045) | (2001 <= b <= 2008) ; when ('0006.00') if b in (3026,3027) | (3067 <= b <= 3074); when ('0007.00') if (3034 <= b <= 3040) | (3056 <= b <= 3060); end; run; ===========================End commented out================================ */ %agg(aggin=aggin,aggout=aggout, aggby=, aggvars=pop2000 intptlat intptlon AreaSqmi p1i1--h55i4, MEANS=intptlat intptlon P17AI1 H17AI1 H18AI1 H18AI2, MWEIGHTS=p1i1 p1i1 P2I1 H2I1 H3I1 H3I2 , debug=1, grand=only) run; data stf901.&pgm(label='Temp aggregation of Ron Carey specified neighborhodd in Springfield'); length sumlev $3 geocode $3 county $5 areaname $40 state $2; retain state '29' county '29077'; set aggout; geocode='001'; SumLev='agg'; *<===Code to indicate custom aggregation===; AreaName='Springfield Special Block-Based District'; AreaSqmi=.; *---because we did not include ZPH blocks--; drop _lvl_ _nag_ ; format intptlon 11.6 intptlat 10.6; **rename intptlng=IntPtLon; *<---------naming convention inconsistent across decades. We normally rename to go with the 2000 name; *---code taken from the sascode(aggstf1.sas) module. Estimate percentiles using median macro--; RETAIN HV1 15000 HV2 HV3 HV4 HV5 HV6 HV7 HV8 5000 HV9 10000 HV10 15000 HV11 HV12 HV13 HV14 HV15 25000 HV16 HV17 50000 HV18 HV19 50000 HV20 200000 R1 100 R2-R14 50 R15 250 R16 500; ARRAY HVALUE HV1-HV20; *<--MEASURES OF THE "WIDTHS" OF H23 CELLS; ARRAY RENTS R1-R16; *<--MEASURES OF THE "WIDTHS" OF H32 CELLS; ARRAY NVALUE H23I1-H23I20; ARRAY NRENTS H32I1-H32I16; %MEDIAN(INTSIZE=HVALUE,INTVALS=NVALUE,Q1=H23AI1,MDN=H23BI1,Q3=H23CI1) %MEDIAN(INTSIZE=RENTS,INTVALS=NRENTS,Q1=H32AI1,MDN=H32BI1,Q3=H32CI1, SAMESTEP=1) *--ROUND ALL VALUES TO NEAREST DOLLAR--*; H23AI1=ROUND(H23AI1); H23BI1=ROUND(H23BI1); H23CI1=ROUND(H23CI1); H32AI1=ROUND(H32AI1); H32BI1=ROUND(H32BI1); H32CI1=ROUND(H32CI1); P17AI1=ROUND(P17AI1,.01); H17AI1=ROUND(H17AI1,.01); H18AI1=ROUND(H18AI1,.01); H18AI2=ROUND(H18AI2,.01); drop hv1-hv20 r1-r16; drop _haf -- _slot2; *--temp vars used by median macro--; run;