x cd /pub/data/acs2009/Tools; %let pgm=agg_cpr_mo3yr09; filename pgm "&pgm..sas"; *---Apply the "cpr" (county PUMA ratio) methodology to get estimated estimates of our standard ACS profiles data for Missouri small counties for 2007-2009 (3-year period estimates). ===== Makes use of the sf32kacs data sets created by setup in acs2007/Tools/agg_cpr_hlspts . Need to run setup acspopests in this same Tools directory to create the latest popests data sets. <==== John Blodgett, OSEDA (U of MO Columbia), Nov. 2009 (original setup coding, adapted for each new vintage year) -Running 1-26-11 to process the 3yr data for 07-09. See https://mcdc.missouri.edu/pub/data/acs/cprmethod.html for a detailed description of the method. ----*; filename cprmacs '/pub/data/acs2007/Tools/cprmacros.sas'; %include cprmacs ; *<--View the code at https://mcdc.missouri.edu/cgi-bin/browse?/pub/data/acs2007/Tools/cprmacros.sas@ --; %let year=2009; %let yr=%substr(&year,3,2); %let yearm1=%eval(&year-1); %let yearm2=%eval(&year-2); %let yrm1=%substr(&yearm1,3,2); %let yrm2=%substr(&yearm2,3,2); %let myrsfx=&yrm2._&yr; *--multi-year suffix. It is 05_07 when year=2007---; %let debug=1; title "&pgm"; title2 "Doing Estimates of Small Mo Counties Using &year 3yr Data With HLSPTs"; libname user "/pub/data/acs&year./temp"; libname temp (user); libname temp07 "/pub/data/acs2007/temp"; *<---We put some stuff in here 2 yrs ago that we can reuse this year---; libname acs "/pub/data/acs&year"; libname cprdata "/pub/data/acs&year./cprdata"; libname cprlast "/pub/data/acs&yearm1./cprdata"; libname sf32kacs "/pub/data/sf32kacs"; %let state=29; %let stab=mo; *---Code here to create the input data source via merging of data from the sf32kacs directory (county and puma data), the latest 3-year period estimates for the PUMAs, and the 3-year pop estimates data created in the acspopests setup.--; *<====Never comment out Phase 0. Accessing metadata and creating global parameters to be used in processing steps, below.===; ***************Phase 0: Create some metadata in global variables**********************; *<======We have to drop this rogue pctfamilypoppoor variable which is not on the metadata=====; proc contents data=acs.usmcdcprofiles3yr(keep=_numeric_ drop=pctfamilypoppoor) noprint out=profilevarsall(keep=name ); run; *---Filter out the new variables that appear on the metadata (variables data set) but are not on the 3yr data set--;; proc sql noprint; select name into :contents_names separated by ' ' from profilevarsall ; quit; %* put &contents_names; %global moevars _means _mweights _aggvars _estvars ; /* ========================begin comment==================================== We do not have to do this any more. bce is creating a variables3yr that should already be in sync with data (1-26-11) *---Create alternate metadata set that has no references to the new insurance variables---; data acs.variables3yr(label='Edited to remove not-in-dataset variable obs') notindata; set acs.variables; *where index(variable_name,'Insur')=0 and variable_name ne 'TotPopNonInst'; if variable_name='pctFamilyPopPoor' then delete; *<===================special case again!!----; if indexw("&contents_names",variable_name) > 0 then output acs.variables3yr; else output notindata; run; ==========================end comment====================================== */ data profilevars moevars ; set acs.variables3yr(rename=(variable_name=name)); ***if index(name,'Insur')=0 and name ne 'TotPopNonInst' then output profilevars; *<---the filtering of TotPopNonInst caused error-; ***if index(upcase(name),'_MOE') then output moevars; output profilevars; if moe_variable ne ' ' then do; name=moe_variable; output moevars; end; *<---new, jan 2011----; run; proc contents data= sf32kacs.sf3&stab.counties (keep=_numeric_) noprint out=sf32kvars(keep=name); run; proc contents data= temp07.mocos2kests(keep=TotPop--huest) noprint out=estvars(keep=name); run; *---we need to create a metadata set where the Pct variables are shown explicitly as they used to be in the acs.variables dataset prior to this year.---; data acs.variables3yr2(label='With Pct variables in their own observations'); set acs.variables3yr; if wtvar ne ' ' then output; else if percent_variable ne ' ' then do; Variable_name=percent_variable; wtvar=UnivVar; output; end; else delete; keep variable_name wtvar; run; proc sql noprint; select name into :moevars separated by ' ' from moevars; ** where name contains 'MOE'; *---The new acs.variables metadata set for 2008 does not contain a dup variable to indicate a duplicate entry so we comment out-; select variable_name into :_means separated by ' ' from acs.variables3yr2 where wtvar ne ' '; *** and dup=0; select wtvar into :_mweights separated by ' ' from acs.variables3yr2 where wtvar ne ' '; *** and dup=0; select name into :_aggvars separated by ' ' from profilevars where name not in ('LogRecno') ; *** no not-in-data vars and no MOE vars, per filtering above.--; select name into :_estvars separated by ' ' from estvars; select variable_name into :notindatavars separated by ' ' from notindata; select name into :sf32kvars separated by ' ' from sf32kvars; quit; %put _global_; /* ========================begin comment==================================== ****************Phase 1: Create county and PUMA level ACS data that will be combined to create the ACS HLSPT summaries.***********; **** 1.1 ****; *---create intermediata data sets with PUMA and County level summaries for the state and year/period with MOE vars removed--; data &stab.cntys (drop=puma5) &stab.pumas (drop=county); set acs.usmcdcprofiles3yr(where=(sumlev in ('050','795') and state="&state") drop=&moevars ); length puma5 $5; if sumlev='795' then puma5=substr(geoid,10,5); if sumlev='050' then output &stab.cntys; else output &stab.pumas; keep sumlev county areaname puma5 datecreated _numeric_; run; data &stab.cntys2; merge &stab.cntys(in=inacsdata) cprdata.mocnty_puma&yr (in=ingeo); *---merge with corr list to add puma5 code---; by county; if inacsdata; if ingeo; run; proc sort; by puma5; run; data agginacs; set &stab.pumas &stab.cntys2; by puma5; *---We use a weighting "trick" of sorts, with the -1 wt value telling our agg utility to subtract the county level data from the PUMA level numbers, giving us the difference which is the hlspt.--; if sumlev='795' then wt=1; else if sumlev='050' then wt=-1; else abort abend; run; ***************************Phase 2: Aggregate the data created in Phase 1 creating the ACS-based "hlspt" dataset. Use our %agg utility with weighting (facvar parm) to do subtraction ***************************; *** 2.1 ****; %agg(aggin=agginacs,aggout=acs.&stab.hlspt_acs, aggvars=&_aggvars, means=&_means, mweights=&_mweights, idvars=datecreated, dropvars=_lvl_ wt, aggby=puma5, facvar=wt) run; data hlspt1; set acs.&stab.hlspt_acs(obs=1); run; proc fsbrowse printall data=hlspt1; title3 "First Obs on the &stab.hlspt_acs data set"; run; title3 ; ************************Phase 3: Comparable to Phase 1, but now working with 2k census data for the same geographic areas****************; *------Create the corresponding "HLSPT" summaries from the 2k census data. We attempt to replicate any missing data so that if a variable for a county is missing on the acs 3yr data then we force it to be missing on the 2k data set as well. This is a little messy, to say the least.------; *** 3.1 ***; data temp.cnty2kwpuma; *---merge step with corr list to add PUMA5 variable--; merge sf32kacs.sf3&stab.counties cprdata.&stab.cnty_puma&yr (in=ingeo); by county; if sumlev='050'; if ingeo; run; proc sort; by puma5 county; run; data temp.aggin_pre2k; set sf32kacs.sf3&stab.pumas temp.cnty2kwpuma; by puma5; *---interleave----; drop esriid areaname logrecno intPt: stab geocode pop2k fipco; *drop counties places; ****drop PctOver15--PctMoveInBefore1969; *----a whole bunch of variables that are not on the sf32kacs data sets--; run; *** 3.2 ***; %include '/pub/sas/macros/genrenam.sas'; *<---for interactive debugging where we edit the macro----; %genrenam(user.agginacs,xvars=sumlev puma5 county wt areaname dateCreated fipco size,sfx=_acs,debug=1) %put ***rename generated to be used with user.agginacs at step 3.2: &rename; %put &rename2; data aggin2k ; merge temp.aggin_pre2k (in=in2k) user.agginacs ( &rename &rename2 in=inacs); *<---We do not keep the acs data for aggregation, but we need it here because we use it to recode 2k values to missing whenever the corresponding ACS variable is missing. =========================================================================================== ---; by puma5 county; if inacs; *--we only keep data for the relevant pumas and counties---; if not in2k then do; put '**** ' puma5= county= " ****Not matched on 2k data set***** aborting run.... " ; abort abend; end; if sumlev='050' then do; *---here is where we check for missing values in the acs data set and MAKE THE CORRESPONDING VARIABLE MISSING FOR 2k DATA!!! --; %macro recode_missing; %global _aggvars; %let naggvars=%lenlst(&_aggvars); %do i=1 %to &naggvars; %let var=%scan(&_aggvars,&i); if &var._acs=. or &var._acs=.N then &var=.A; %end; *----drop the ACS variables from output set.----; drop %do i=1 %to &naggvars; %let var=%scan(&_aggvars,&i); &var._acs %str( ) %end; ; %mend recode_missing; options NOmprint; *<========================================================================; %recode_missing end; run; ********************************Phase 4: Aggregate the 2k census data to get that HLSPT data set**********************************; *---begin by doing some macro magic creating variable lists where we limit the variabales to those that are actually on the sf32k sets; %global _means2k _mweights2k _aggvars2k; %xlists(sf32kvars,_aggvars,_aggvars2k,nolog=1) %xlists(sf32kvars,_means ,_means2k,nolog=0) %****xlists(sf32kvars,_mweights,_mweights2k,nolog=0) ; *---Not helpful. We need to totally generate the _mweights2k list--; %macro genwts2k; %*---take each variable in the _means2k list and find it in the _means list. Then find the corresponding word in the _mweights list and add that to the new _mwieghts2k list. --; %global _mweights2k _means2k _means _mweights; %local nmw i i2 var var2 wtvar2; %let nmw=%lenlst(&_means2k); %let i2=1; %*--i2 indexes the _means and _mweights lists, while i indexes _means2k---; %do i=1 %to &nmw; %let var=%scan(&_means2k,&i); %do %until (&var = &var2); %let var2=%scan(&_means,&i2); %if %superq(var)=%superq(var2) %then %do; %let wtvar2=%scan(&_mweights,&i2); %let _mweights2k=&_mweights2k &wtvar2; %put &i &var &wtvar2 ; %end; %let i2=%eval(&i2+1); %end; %end; %mend genwts2k; %genwts2k ; *---captured the results of invoking the genwts2k macro and just include it here-----; %***let _mweights2k=TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop Males Males TotPop Females Females TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotPop TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs NumHHEarnings TotHHs NumHHSocSec TotHHs NumHHRetInc TotHHs NumHHSuppSecInc TotHHs NumHHPubAssist TotHHs FamHHs FamHHs FamHHs FamHHs FamHHs FamHHs FamHHs FamHHs FamHHs FamHHs FamHHs FamHHs TotPop TotHHs NonFamHHs NonFamHHs FullTimeWorkers FullTimeWorkersMale FullTimeWorkersFemale PovUniverse PovUniverseUnder18 PovUniverse18_64 PovUniverseOver65 PovUniverse PovUniverse FamilyPop PovUniverseUnrelated PovUniverse PovUniverse PovUniverse PovUniverse Over16 Over16 CivLabForce CivLabForce Over16 Over16 Over16 Over16 Over16 CivLabForceFemales OwnKidsUnder6 OwnKidsOver6 Worker16 Worker16 Worker16 Worker16 Worker16 Worker16 Worker16 Commuters EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF EmployedCLF TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs TotHHs Families TotPop TotPop TotPop TotPop TotPop TotPop HHPop HHPop HHPop HHPop HHPop HHPop TotHHs Over15 Over15 Over15 Over15 Over15 Over3 EnrolledOver3 EnrolledOver3 EnrolledOver3 EnrolledOver3 EnrolledOver3 Over25 Over25 Over25 Over25 Over25 Over25 Over25 Over25 Over25 Over18 Over18 Civilian TotPopNonInst NonInstOver65 TotPop TotPop TotPop TotPop TotPop TotPop ForeignBorn ForeignBorn BornOutsideUS TotPop Over5 Over5 Over5 Over5 Over5 TotHUs OccHUs OccHUs OwnerOcc RenterOcc TotHUs VacHUs VacHUs VacHUs TotalOwnerUnits TotalRentalUnits TotPop TotPop TotHUs TotHUs TotHUs TotHUs TotHUs TotHUs TotHUs TotHUs TotHUs TotHUs TotHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OccHUs OwnerOcc OwnerOcc OwnerOcc OwnerOcc OwnerOcc OwnerOcc OwnerOcc OwnerOcc OwnerOcc OwnerOcc OwnerOcc OwnerOcc HUsMort OwnerOcc OwnerOcc HUsNoMort RenterOcc RenterOcc RenterOcc RenterOcc RenterOcc; %put *** _means2k=&_means2k; %put *** _mweights2k=&_mweights2k; %macro displaywts; %global _means2k _mweights2k; %local i mean weight; %let nmeans=%lenlst(&_means2k); %let nweights=%lenlst(&_mweights2k); %if &nmeans lt &nweights %then %let uplim=&nmeans; %else %let uplim=&nweights; %do i=1 %to &uplim; %let mean=%scan(&_means2k,&i); %let weight=%scan(&_mweights2k,&i); %put &i %str( )&mean %str( ) &weight ; %end; %mend displaywts; %***displaywts ; options NOmprint; *** 4.1 ***; %agg(aggin=aggin2k,aggout=sf32kacs.&stab.hlspt_2k, aggvars=&_aggvars2k, means=&_means2k, mweights=&_mweights2k, dropvars=_lvl_ wt, aggby=puma5, facvar=wt) run; data hlspt2; set sf32kacs.&stab.hlspt_2k(obs=1); run; proc fsbrowse printall data=hlspt2; title3 "First Obs on the &stab.hlspt_2k data set"; run; title3 ; *************************Phase 5: Prepare the various data sets to be used in the CPR step. Lots of variable renaming here**************; *** 5.1 ***; *---Use utility macro to generate the rename code to be used in subsequent data step to append a sfx to all numeric vars-; %genrenam(sf32kacs.sf3&stab.counties,xvars=state county sumlev,sfx=_c2x) data cnty2k; merge sf32kacs.sf3&stab.counties ( &rename where=(state="&state" and sumlev="050") ) cprdata.&stab.cnty_puma&yr (in=ingeos); by county; if size='s' ; *** or size='m'; *---we cannot keep the m size cos & estimate their data for checking purposes with this hlspt--; run; data temp.&stab.cos2kests(label="2k census county data with _c2x varname suffixes + &yr 3yr estimates" ); merge cnty2k(in=in2kdata) cprdata.&stab.estimates3yr(in=inests) cprdata.&stab.cnty_puma&yr(in=inclist); by county; if in2kdata; if not (in2kdata and inests and inclist) then do; put / '*****ERROR: county not matched on county-puma equivalency dataset or on estimates dataset ***** ' / _all_; abort abend; end; run; proc sort; by puma5 county; run; %***content(temp.&stab.cos2kests); *** 5.2 ***; %genrenam(sf32kacs.&stab.hlspt_2k,xvars=state puma5,sfx=_p2x,renamevar=renmp2x) *---Save the rename global just generated so we can use it in Step 5.3, below---; %**let rename_p2x=&rename &rename2; %genrenam(acs.&stab.hlspt_acs,xvars=sumlev state puma5 ,sfx=_pacs,renamevar=renmpacs) %***let rename_pacs=&rename &rename2; *** 5.3 ***; data temp.pumastemp; merge sf32kacs.&stab.hlspt_2k (in=inpuma2k &renmp2x &renmp2x2 ) acs.&stab.hlspt_acs (in=inpumaacs &renmpacs &renmpacs2) temp.&stab.cos2kests(in=incos); by puma5; if incos; *---We may have data for some pumas that are not needed---; if not (inpuma2k and inpumaacs and incos) then do; put '****match not working in test step****' +2 inpuma2k= inpumaacs= incos= puma5= county=; abort abend; end; else output; run; ==========================end comment====================================== */ options mprint NOmlogic; *******************************Phase 6: Apply the CPR method **************************************; *** 6.1 ***; *------------------------------Data Step to "apply CPR" method to estimate data for counties for the 3yr period---------; data cprdata.SmallCounties3yr(label='3yr estimates for all MO small counties allocated using CPR method with HLSPT'); length county $5; if 0 then set acs.usmcdcprofiles3yr(drop=&moevars); *---add more drop vars here to get rid of what we do not want. Allows us to to a double-dash keep to specify what gets kept on output. It is all we specify here.---; set temp.pumastemp; Areaname=areaname_c2x; SumLev='050'; geocode=county; geoid='05000US'||county; Period='3cp'; *--3yr, cpr method estimated--; if &debug then put / areaname=; *-------------------------------Demographic-----------------------------------; *---We have a bunch of estimates variables that are being loaded but they are counts without pcts. In this section we calculate all those missing Pct variables. Have to be careful, using double-dash lists here.--; array estspcts(*) age0_4--PctOver85 Over5--PctNonHispHawnPI; _nestspcts=dim(estspcts); _icnt=1; _ipct=2; do _i=1 to _nestspcts by 2; *--The array alternates between counts in the odd cells and Pct vars in the even cells. All pcts use Totpop as the denom.--; estspcts(_ipct)=100*estspcts(_icnt)/totpop; _icnt+2; _ipct+2; end; drop _: ; * ------------------------------end estimates pctVar calculations------------------; *-------------------------------Economic--------------------------------------; TotHUs=huest; %applycpr(PctOccHUs,acsvar=PctOccHUs); TotHHs=round(TotHUs*.01*PctOccHUs); OccHUs=TotHHs; %dodist(hhinc, 0 10 15 25 35 50 75 100 150 200, TotHHs) %applycpr(MedianHHInc) %applycpr(AvgHHInc) %applycpr(NumHHEarnings,PctOf=TotHHs) %applycpr(AvgHHEarnings) %applycpr(NumHHSocSec,PctOf=TotHHs) %applycpr(AvgHHSocSec) %applycpr(NumHHRetInc,PctOf=TotHHs) %applycpr(AvgHHRetInc) %applycpr(NumHHSuppSecInc,PctOf=TotHHs) %applycpr(AvgHHSuppSecInc) %applycpr(NumHHPubAssist,PctOf=TotHHs) %applycpr(AvgHHPubAssist) if PctFamHHs_p2x=. then do; PctFamHHs_c2x=100*FamHHs_c2x/TotHHs_c2x; PctFamHHs_p2x=100*FamHHs_p2x/TotHHs_p2x; PctFamHHs_pacs=100*FamHHs_pacs/TotHHs_pacs; end; %acprpct(FamHHs,TotHHs) %dodist(FamHHInc,0 10 15 25 35 50 75 100 150 200,FamHHs) %applycpr(MedianFamInc) %applycpr(AvgFamInc) %applycpr(PCI) NonFamHHs=TotHHs - FamHHs; PctNonFamHHs=100*NonFamHHs/TotHHs; %apcprlst(MedianNonFamInc AvgNonFamInc MedianEarnings MedianEarningsFemale MedianEarningsMale) *----We do not keep a PctPovUniverse variable on the current acs profiles datasets. But we have the components so we just calculate it here so that it can be plugged in to the subsequent applycpr estimation.---; PctPovUniverse_pacs=100*PovUniverse_pacs/TotPop_pacs; %applycpr(PctPovUniverse) if PctPovUniverse gt 100 then PctPovUniverse=100; PovUniverse=round(PctPovUniverse*.01*TotPop); ***PctPovUniverse=100*PovUniverse/TotPop; *--Poverty universes for 3 age cohorts are estimated by assuming the pu as a pctage of total pop in the cohort is fixed--; PovUniverseUnder18= round( (PovUniverseUnder18_c2x/Under18_c2x)*Under18 ); _age18_64_c2x=Totpop_c2x - Under18_c2x - Over65_c2x; _Age18_64=Totpop - Under18 - Over65; PovUniverse18_64= round( (PovUniverse18_64_c2x/_Age18_64_c2x)*_Age18_64 ); PovUniverseOver65= round( (PovUniverseOver65_c2x/Over65_c2x)*Over65 ); *---edit this drop list to always start with the next variable not yet estimated--; %applycpr(PctPoor) Poor=round( PovUniverse*.01*PctPoor ); %applycpr(PctPoorUnder18) PoorUnder18=round( PctPoorUnder18*.01*PovUniverseUnder18 ); %applycpr(PctPoor18to64) Poor18to64=round( PctPoor18to64*.01*PovUniverse18_64); %applycpr(PctPoorOver65) PoorOver65=round( PctPoorOver65*.01*PovUniverseOver65); %acprpct(FamilyPop,TotPop) %acprpct(PoorInFamily,FamilyPop) %acprpct(PovUniverseUnrelated,TotPop) %acprpct(PoorUnrelated,PovUniverseUnrelated) %***dodist(PovRatio,UnderHalf v5tov75 v75to1 1to2) ;*** rest not available in 2k census... 2to3 Over3,PovUniverse); *--NOT full dist; %acprpct(PovRatioUnderHalf,PovUniverse) %acprpct(PovRatiov5tov75,PovUniverse) %acprpct(PovRatiov75to1,PovUniverse) %acprpct(PovRatio1to2,PovUniverse) PovRatioOver2=0; PovRatioOver2=PovUniverse - sum(of PovRatioUnderHalf PovRatiov5tov75 PovRatiov75to1 PovRatio1to2); MeanPovRatio= (PovRatioUnderHalf*0.25 + PovRatiov5tov75*0.675 + PovRatiov75to1*0.875 + PovRatio1to2*1.5 + PovRatioOver2*3.0) / PovUniverse; %acprpct(LaborForce,Over16); ***LaborForce=PctLaborForce*.01*Over16; %acprPct(CivLabForce,Over16) ***CivLabForce=PctCivLabForce*.01*Over16; %acprPct(EmployedCLF,CivLabForce) UnemployedCLF=CivLabForce-EmployedCLF; PctUnemployedCLF=100*UnemployedCLF/CivLabForce; %acprPct(Military,Over16) NOTinLF=Over16 - Military - CivLabForce; PctNOTinLF=100*NOTinLF/Over16; %acprPct(Over16Females,Over16); %acprPct(LaborForceFemales,Over16Females) %acprPct(CivLabForceFemales,Over16Females) %acprPct(EmployedFemales,CivLabForceFemales) %applycpr(OwnKidsUnder6) %applycpr(OwnKidsOver6) %acprPct(OwnKidsO6AllPrntsWk,OwnKidsOver6) %acprPct(OwnKidsU6AllPrntsWk,OwnKidsUnder6) %applycpr(Worker16) %acprPct(Commuters,Worker16) %acprPct(DriveAlone,Worker16) %acprPct(Carpool,Worker16) %acprPct(PublicTrans,Worker16) %acprPct(WalktoWork,Worker16) %acprPct(OtherCommute,Worker16) %acprPct(WorkAtHome,Worker16) %applycpr(AvgCommute) %acprPct(ManProfOccs,EmployedCLF) %acprPct(ServiceOccs,EmployedCLF) %acprPct(SalesOffOccs,EmployedCLF) %acprPct(FarmFishOccs,EmployedCLF) %acprPct(ConsOccs,EmployedCLF) %acprPct(TransOccs,EmployedCLF) %acprPct(Agriculture,EmployedCLF) %acprPct(Construction,EmployedCLF) %acprPct(Manufacturing,EmployedCLF) %acprPct(WholesaleTrade,EmployedCLF) %acprPct(RetailTrade,EmployedCLF) %acprPct(Transportation,EmployedCLF) %acprPct(Information,EmployedCLF) %acprPct(Finance_Ins,EmployedCLF) %acprPct(Professional,EmployedCLF) %acprPct(Educ_Health_SocSvcs,EmployedCLF) %acprPct(RecreationEtc,EmployedCLF) %acprPct(OtherIndustries,EmployedCLF) %acprPct(PublicAdmin,EmployedCLF) %acprPct(PrivWageWorkers ,EmployedCLF) %acprPct(GovWorkers ,EmployedCLF) %acprPct(SelfEmpWorkers ,EmployedCLF) %acprPct(UnpaidFamWorkers ,EmployedCLF) *-------------------------------Social----------------------------------------; Families=FamHHs; PctFamilies=PctFamHHs; %acprPct(FamsWithKids, TotHHs) %acprPct(MarriedCouples, TotHHs) %acprPct(CouplesWithKids, TotHHs) %acprPct(SingleMaleFamilies, TotHHs) %acprPct(SingleFathers, TotHHs) %acprPct(SingleFemaleFamilies, TotHHs) %acprPct(SingleMothers, TotHHs) %acprPct(NonFamHHs, TotHHs) %acprPct(LivingAlone, TotHHs) %acprPct(Over65Alone, TotHHs) %acprPct(FamsWithKids, TotHHs) %acprPct(HHsWithKids, TotHHs) %applycpr(AvgHHSize,round=%str(.1)) %applycpr(AvgFamSize,round=%str(.1)) %acprPct(HHpop,Totpop) %acprPct(FamHHPop,Totpop) NonFamHHPop=Totpop - FamHHPop; PctNonFamHHpop=100*FamHHPop/Totpop; %acprPct(GrpQuarters,TotPop) Householder=TotHHs; PctHouseholder=100*Householder/TotPop; %acprPct(Spouse, HHpop) %acprPct(Child, HHpop) %acprPct(OtherRelative, HHpop) %acprPct(NonRelative,HHpop) %acprPct(UnmarriedPartner, HHpop) UMPartnerHHsPerK=1000*UnmarriedPartner/TotHHs; %acprPct(NeverMarried,Over15) %acprPct(Married,Over15) %acprPct(Separated,Over15) %acprPct(Widowed,Over15) %acprPct(Divorced,Over15) %let debug=2; %acprPct(EnrolledOver3,Over3) *-----Original coding specified wrong universe variable for these 5 vars. We had over3 instead of enrolledover3---; %acprPct(InNursery,EnrolledOver3) %acprPct(InKindergarten,EnrolledOver3) %acprPct(InElementary,EnrolledOver3) %acprPct(InHighSchool,EnrolledOver3) %acprPct(InCollege,EnrolledOver3) %let debug=1; %acprPct(LessThan9th, Over25) %acprPct(SomeHighSchool, Over25) %acprPct(HighSchool, Over25) %acprPct(SomeCollege, Over25) %acprPct(Associates, Over25) %acprPct(Bachelors, Over25) %acprPct(Bachelorsormore, Over25) %acprPct(GradProf, Over25) %acprPct(HighSchoolOrMore,Over25) %acprPct(ArmedForces, Over18) %acprPct(Civilian, Over18) %acprPct(Veteran, Over18) %applycpr(disabledUniv5) %acprPct(Disabled, DisabledUniv5) %applycpr(DisabledUniv5_15) %acprPct(Disabled5_15, DisabledUniv5_15) %applycpr(DisabledUniv65) %acprPct(DisabledElder, DisabledUniv65) %applycpr(DisabledUniv16_64) %acprPct(Disabled16_64, DisabledUniv16_64) %acprPct(UsNative, Totpop) %acprPct(BornInUS,Totpop) %acprPct(BornInCurrState, Totpop) %acprPct(BornInDiffState, Totpop) %acprPct(ForeignBorn, Totpop) %***acprPct(Naturalized, Totpop) ; %***acprPct(NonCitizen, Totpop) ; %*--these 2 variables changed 2-3-10---; %acprPct(Naturalized, ForeignBorn) %acprPct(NonCitizen, ForeignBorn) %acprPct(BornInDiffState, Totpop) %acprPct(FBMinusSea, Totpop) %acprPct(FBEurope, FBMinusSea) %acprPct(FBAfrica, FBMinusSea) %acprPct(FBOceania, FBMinusSea) %acprPct(FBLatinAmerica, FBMinusSea) %acprPct(FBEurope, FBMinusSea) %acprPct(FBNorthAmerica, FBMinusSea) %acprPct(EnglishOnly, Over5) %acprPct(OthLang, Over5) %acprPct(OthLangEnglishLTD, Over5) %acprPct(Spanish, Over5) %acprPct(SpanishEnglishLTD, Over5) *---------------------Housing-----------------------------*; %acprPct(OwnerOcc, TotHUs) %acprPct(RenterOcc, TotHUs) %acprPct(PersonsInOwnerUnits,TotPop) %acprPct(PersonsInRenterUnits,TotPop) %applycpr(AvgOwnerHHSize) %applycpr(AvgRenterHHSize) %acprPct(VacHUs,TotHUs) %acprPct(VacantForSale,vachus) %acprPct(VacantForRent,vachus) %acprPct(VacantSeasonal,vachus) TotalOwnerUnits=RenterOcc+VacantForRent; OwnerVacRate=100*VacantForSale/TotalOwnerUnits; TotalRentalUnits=RenterOcc+VacantForRent; RenterVacRate=100*VacantForRent/TotalOwnerUnits; %alias(MobileHomes,UnitsMH) %alias(BoatRV,UnitsRV) %dodist(units,1Detached 1Attached 2 3_4 5_9 10_19 20up MH RV, TotHUs) Units1=Units1Attached + Units1Detached; PctUnits1=100*Units1/TotHUs; MobileHomes=UnitsMH; PctMobileHomes=PctUnitsMH; *---will this work??---; BoatRV=UnitsRV; PctBoatRV=PctUnitsRV; *---will this work??---; drop unitsmh unitsrv pctunitsmh pctunitsrv; MobilehomesPerK=1000*MobileHomes/TotHUs; %alias(NoVehicles,Vehicles0) %dodist(Vehicles,0 1 2 GE3,OccHus) NoVehicles=vehicles0; PctNoVehicles=PctVehicles0; drop vehicles0 pctvehicles0; %dodist(HHF,UtilGas LPGas Electric Kerosene Coal Wood Solar Other NoFuel,OccHUs) %acprPct(NoPlumbing,OccHUs) %acprPct(NoKitchen,OccHUs) %acprPct(NoPhone,OccHUs) %acprPct(PersonsPerRoomLow,OccHUs) %acprPct(PersonsPerRoomMedium,OccHUs) %acprPct(PersonsPerRoomHigh,OccHUs) %dodist(Hval,Under50 50 100 150 200 300 500 OverMillion,OwnerOcc) *<----Not exactly, we have "specified" units in 2k--; %applycpr(MedianHValue) %applycpr(AvgHValue) %acprPct(HUsMort,OwnerOcc) %acprPct(HUsMortOver30Pct,OwnerOcc) %applycpr(MedianOwnerCostsMort) %acprPct(HUsNoMort,OwnerOcc) %acprPct(HUsNoMortOver30Pct,OwnerOcc) %applycpr(MedianOwnerCostsNoMort) %acprPct(NOCashRenter,RenterOcc) %applycpr(MedianGrossRent) %applycpr(AvgGrossRent) %acprPct(CashRenterOver30Pct,RenterOcc) %acprPct(CashRenterOver750,RenterOcc) *--new strategy for how to specify what to keep and drop. We start with broad keep list, then use drop stmts to specify exceptions. We need to only keep the estimates and drop all the input from other sources----; keep county years period geoid sumlev areaname state DataCreated; *<---ids--; keep TotPop--PctCashRenterOver750; *<---these are the basic variables for the profiles, not all of which get estimated--; drop povRatio2to3 pctPovRatio2to3 PovRatioOver3 PctPovRatioOver3; *---Not available in sf32k---; drop UnmarriedWomen15to50--BirthRate35to50; drop GrandPrnts: PctGrandPrnts: SameHouse--LivedAbroad; run; **** 6.2 ***; options ls=160 ps=80 nodate; data atchison_pike; set &syslast; where county in ('29005','29163'); run; proc fsbrowse printall data=atchison_pike; title3 "Estimated data for Atchison & Pike Counties"; run; proc sort data=cprdata.smallcounties3yr ; by county; run; data cprdata.allcounties3yr(label="All Missouri counties "); length fipco $5; set cprdata.smallcounties3yr acs.usmcdcprofiles3yr(where=(state='29' and sumlev='050')) ; by county; state='29'; drop geocomp_name geocomp--CashRenterOver750_moe; fipco=county; run;