==> bg5yr_basetbls.sas <== x cd /pub/data/acs2011/Tools; %let pgm=bg5yr_basetbls; filename pgm "&pgm..sas"; *---Create the new and improved block group level base tables data set. Merges data created by Glenn R. in the revised_basetbls temp subdirectory with the selected allgeos data set. A key is to specify shorter variables, with lengths of 4 instead of 8 bytes. jgb, 4-10-13. ---*; libname btabsR '/pub/data/acs2011/revised_basetbls' ; libname btabs5yr '/pub/data/acs2011/btabs5yr'; libname btabs '/pub/data/acs2011/basetbls'; %libname(acs2011); options compress=binary; %macro geofltr; *here state in ('10','11'); *--Delaware and DC for test. Use same filter in step to create ids set above.--; *where state in ('29'); %mend geofltr; data call_symputs(compress=no); set btabs.bgvarsmeta; if lowcase(tgrp)='085yr' then tgrp='08'; macname="bgvars"||tgrp; call symput(macname,trim(bgvars)); bgmoes=translate(bgvars,'m','e'); *--the corresponding MOE variable uses lower case m instead of e. So for estimate b00001e1 we have the corr moe as m00001m1 . --; macname="bgmoes"||tgrp; call symput(macname,trim(bgmoes)); run; ==> bgdata_harlan_maps.sas <== x cd /pub/data/acs2011/Tools; %let pgm=bgdata_harlan_maps; filename pgm "&pgm..sas"; *---Generate dataset with key items JH needs for his mapping. We begin using the 2010 vintage data as we await the arrival of 2011 vintage just released. jgb, 12/12. ---*; %let acsyear=2010; libname basetbls "/pub/data/acs&acsyear./basetbls"; libname acs20xx "/pub/data/acs&acsyear."; %let period=5yr; %let vintage=&acsyear; %let vintagem5=%eval(&vintage-5); %let year=&vintagem5 to &vintage; /* variables requested in e-mail 12-6-12 11:00 am %male %female %18&under %65&greater Median hhinc Avg hhinc Per-capita income %poor %no high school %high school %high school & greater ==> check_revised_basetbls.sas <== x cd /pub/data/acs2011/Tools; %let pgm=check_revised_basetbls; filename pgm "&pgm..sas"; *---This program looks at our collection of base tables and runs checks to see which ones actually have data in them. This was deemed necessary as we started running into problems with some tables being missing for all or many observations in various data sets. We are running this for the 2011 collections and need to run similar setup for prior and future vintages. jgb, 10-1--13. ---*; %let vintage=2011; filename modlcode "gen_tablevars.sas"; libname basetbls "/pub/data/acs&vintage./basetbls"; libname btabs (basetbls); libname btabs5yr "/pub/data/acs&vintage./btabs5yr"; *libname btabsR "/pub/data/acs&vintage./revised_basetbls"; *---Lets do btabsR - the "revised" base tables from GR - to see which tables we really have data for---; *---rerun with revised revised tables per note from GR: I'm running a new set of 2011 5-year base tables. The main group is copying over now. The new folder is at /web/mcdc/www/data/acs2011/revised_basetables_oct_2013/. Can you please check these for misses like you did before. ----*; libname btabsR "/pub/data/acs&vintage./revised_basetables_oct_2013"; /* ========================begin comment==================================== ods listing close; ods output attributes=attout; proc contents data=btabsr.ustabs00_075yr_moes ; proc contents data=btabsr.ustabs00_075yr ; run; ods listing; ==> cnvt_geo_files.sas <== x cd /pub/data/acs2011/Tools; %let pgm=cnvt_geo_files; filename pgm "&pgm..sas"; *---The rerun in April did not work becuase the input file was missing--------------------; *---Read data from the geo-header Summary files ascii files (as downloaded and processed by Billy Earney) to create sas datasets. jgb, 11-12. Ran 1-3-13 and again 4-10-13. This time to get cbsa related codes whenever we know the county. We changed the cbsa lookup data set to georef.cbsacos09 . Do NOT do that next year! Modeled after acs2007 setup of the same name. ---*; %let year=2011; %let yearm4=%eval(&year-4); %let period=&yearm4._&year; %let yr=%substr(&year,3,2); title "&pgm.: Convert &year &period Geographic headers Data"; options compress=yes; libname acs&year "/pub/data/acs&year"; *<====; libname user '/tmp/scratch/userb'; %libname(georef); *---Read and store the state geographic identifiers file---; *filename geos "/web/mcdc1/scripts2/acs/&period./geocodes/geocodes.txt"; filename geos "/web/mcdc1/scripts2/geocodes_2007_2011.txt"; *--Glenn put this file here 12-27-12--; data allgeos. infile geos lrecl=2100 truncover; length SumLev $3 geoid $40 AreaName $100 Geocomp_Name $2 esriid $16 ==> create_basetables_varlabs11.sas <== x cd /pub/data/acs2011/Tools; %let pgm=create_basetables_varlabs11; filename pgm "&pgm..sas"; *---We used to do a lot more in a comparable setup here. But the creation of the metadata sets (basetbls.variablesXXXXX) is now handled by Billy Earney using scripts stored elsewhere.---; *---We created the model for this setup in the corresponding acs2010/Tools directory Oct, 2012. Now running it for the 2011 data--; %let year=2011; title "&pgm: Generate Variable label txt files in acs&year./basetbls/Varlabs folder"; %let btpath=%str(/pub/data/acs&year./basetbls); libname basetbls "&btpath"; libname temp "&btpath./temp"; *---we moved the variables**** sets as transferred to this temoorary location to allow us to update them and store the edited versions in the basetbls directory with the same set names-; filename csvbgs "&btpath./5_year_detailed_tables.csv" ; *---Create a metadata set with the IDs of those tables avaialbe at the BG level. We read a csv file created from an xls file downloaed from Bureau web site.---; options msglevel=i; data basetbls.bgtabs(label='IDs of tables available at the BG level'); infile csvbgs dsd truncover firstobs=2 termstr=crlf; length TableID $8 TableTitle $128 bgflag 3 Topic $2 _field3 $8 _bgflagin $6; input TableID TableTitle _field3 _bgflagin; if _n_ le 10 then put tabletitle= _bgflagin=; if tableID=' ' then stop; Topic=substr(TableID,2,2); bgflag= (_bgflagin ne ' '); drop _: ; run; proc sort; by TableId; run; ==> doviews.sas <== %macro doviews(tgroups=00_07 08 09_16 17_20 21_24 25_27); %let ng=1; %let tgroup=%scan(&tgroups,1); %do %until (&tgroup=%str()); proc sql; create view btabs5yr.motracts&tgroup(label="MO subset of ustracts&tgroup") as select * from ustracts&tgroup where state='29'; quit; %let ng=%eval(&ng+1); %let tgroup=%scan(&tgroups,&ng); %end; %mend doviews; options mprint; %doviews(tgroups=00_07 08 09_16 17_20 21_24 25_27); ==> editlog.sas <== data _null_; infile "&pgm..tmp.log"; input cc $1.; if _infile_=:"WARNING:" then delete; if cc='0c'x or _infile_=' ' then delete; ������������������������������������������������� file "&pgm..log"; put _infile_; run; ==> fix080ids.sas <== x cd /pub/data/acs2011/Tools; %let pgm=fix080ids; filename pgm "&pgm..sas"; *--See of we can fix the problem with truncated geoid/esriid/placefp values on the level 080 sets--; *---Seems impossible for now. Maybe later.... ; libname acs '/pub/dat/aacs2011'; %libname (sf12010x); data ustracs08temp/view=ustracts08temp; set sf12010x.ustracts080; esriid=substr(esriid,1, data acs.ustracts0805yr(label='With fixed geocodes' index=(state)); set acs.ustractsH5yr; ==> fixprofiles2.sas <== x cd /pub/data/acs2011/Tools; %let pgm=fixprofiles2; filename pgm "&pgm..sas"; *---Update the acs.usmcdcprofiles5yr2 data set from the new _fixed version created by Glenn circa 6-4-13. We replace the geoid so that it is not truncated. It changes from $20 to $28 . For 080 and 070 levels it is critical. IMPORTANT NOTE: After verifying this job ran OK, we interactively renamed the 2 5yr2 datasets, so that *5yr2 becomes *5yr2old and *5yr2f becomes the new *5yr2 . jgb, 6-5-13. ---; libname acs2011 '/pub/data/acs2011'; /* ========================begin comment==================================== data acs2011.usmcdcprofiles_geoidfixes(label='Extract from GRs usmcdcprofiles5yr_fixed' compress=no index=(obsno)); set acs2011.usmcdcprofiles5yr_fixed(keep=geoid); obsno+1; if length(geoid) >= 20; *--we only keep the long ones---; run; ==========================end comment====================================== */ data acs2011.usmcdcprofiles5yr2f(compress=binary index=(state)); length geoid $28; set acs2011.usmcdcprofiles5yr2(rename=(geoid=_ckid)); obsno+1; drop obsno; if length(_ckid)=20 then do; set acs2011.usmcdcprofiles_geoidfixes key=obsno; _nfixed+1; if _nfixed le 5 then put obsno= _iorc_= geoid= ; ==> gen_acsvarlist.sas <== x cd /pub/data/acs2011/Tools; %let pgm=gen_acsvarlist; filename pgm "&pgm..sas"; *---access the variables metadata set to generate macro variables acsmeans and acsmwts which can be use to aggregate the 5yr data sets. Had to rerun with new acs2010.variables5yr set 3-16-12. Rerunning from acs2011/Tools 6-13 with additional code to generate the meansbg and mwgtsbg vars. (Earlier run was done from acs2010/Tools). ---; %libname (acs2011); /* ========================begin comment==================================== data variables5; set acs2010.variables5yr(keep=variable_name percent_variable wtvar univvar); retain acs5yrvars "%varlist(_numeric_,acs2010.ustracts5yr)"; if _n_=1 then acs5yrvars=upcase(acs5yrvars); if index(acs5yrvars,trim(upcase(variable_name))) then output; else put variable_name= ' --deleted ***'; run; proc sql noprint; select percent_variable into :pctvars separated by " " from variables5 where percent_variable ne ' '; select univvar into :pctwts separated by " " from variables5 where percent_variable ne ' ';; select variable_name into :means separated by " " from variables5 where wtvar ne ' '; select wtvar into :mwgts separated by " " from variables5 where wtvar ne ' '; data _null_; set acs2010.ustracts5yr(keep= &pctvars &means); *---this will trigger errors when we have variables not on data set-; stop;run; ==> gen_tablevars.sas <== x cd /pub/data/acs2011/Tools; %let pgm=gen_tablevars; filename pgm "&pgm..sas"; *---Generate macro variables that will be used in manipulating the vary large 5yr base tables. jgb, 4-8-13. ---*; libname user '/tmp/scratch/user'; libname btabsR '/pub/data/acs2011/revised_basetbls' ; libname btabs '/pub/data/acs2011/basetbls'; %libname(acs2011); %global bgtabs; options mprint; %macro dotabs(tgroups=00_07 08 09_16 17_20 21_24 25_27); /* ========================begin comment==================================== %let ng=1; %let tgroup=%scan(&tgroups,1); %do %until (&tgroup=%str()); proc contents data=btabsr.ustabs&tgroup.5yr noprint out=Contents&tgroup(keep=memname name type where=(type=1)); run; %let ng=%eval(&ng+1); %let tgroup=%scan(&tgroups,&ng); %end; ==========================end comment====================================== */ data varsview/view=varsview; set ==> invoke_dosets.sas <== x cd /pub/data/acs2011/Tools; %let pgm=invoke_dosets; filename pgm "&pgm..sas"; /*--Invoke the %doset macro to create observations in the Datasets dataset for this directory. J. Blodgett, OSEDA, Sep. 2012 Jan. /Feb. 2013 March 9, 2013: Rerunning with deleted data sets deleted and with special step to reassing sortprio to get more logical ordering of Datasets. -- */ title "Job to Invoke doset Macro for Sets in acs2011, creating acs2011.datasets"; %*et todolist=ussldu12s5yr ussldl12s5yr ; %let todolist=usmcdcprofiles3yr usmcdcprofiles5yr; %let libnameG=acs2011; libname acs2011 '/pub/data/acs2011'; /*<=========================Comment out===================================== *-----Run this step ONLY ONCE------------------------------------------; *----If you need to rerun (start over) then delete the datasets dataset first. doset will not allow initialize mode if the datasets set already exists.---; %doset(mode=initialize, libname=acs2011,debug=1); ===========================End commented out================================ */ *----------------------------------------------------------------------; %doset( ==> mcdcprofiles5yr.sas <== x cd /pub/data/acs2011/Tools; %let pgm=mcdcprofiles5yr; filename pgm "&pgm..sas"; *---Rerunning 3-8-13 after finding problem with state code assigned to zctas (860 sumlevs)-----*; *---Process the full 5-year period estimates file as created by gr from downloaded base tables. Here we create multiple data sets based on geography. The partitioning is modeled after the way we processed the sf1 national file for 2010. In fact, we attempt to match obs on the parallel data sets and transfer the 2010 census total pop figure and some GIS vars (lat-long coords, areas) as part of the output acs data sets. John Blodgett, OSEDA, under contract with the Missouri Census Data Center. November, 2011. Note that we do not have sf1 data for metros or for county portions of places and cdslds. In the latter case we went ahead and did the merge but the sf1-based variables are missing for the within-county summaries. Rerunning 1-8-13 after job tempusbgs.sas run to create 3 new "temp" input sets, with tracts and bgs separated from the rest of usmcdcprofiles5yr. In the future we hope to get those data sets directly from GR. **************NOTE! *************************************************** We shall do the bgs datasets in a separate run, usbgprofiles.sas . **************NOTE! *************************************************** ---*; %let year=2011; %let yr=%substr(&year,3,2); %let yearm4=%eval(&year -4); %let yrm4=%substr(&yearm4,3,2); libname acs "/pub/data/acs&year"; libname acs&year "/pub/data/acs&year"; ==> molibdist_allocation.sas <== x cd /pub/data/acs2011/Tools; %let pgm=molibdist_allocation; filename pgm "&pgm..sas"; *---Allocate BG level data from the 2007-2011 ACS period estimates to 2012 vintage MO library districts. June, 2013 ---*; %libname(corrlst); libname acs2011 '/pub/data/acs2011'; libname user '/tmp/scratch/user'; %let geo=distcode; *---the following assignments were taken from the work done in setup gen_acsvarlist (which had to be rerun with variables5yr)---; %let ACSMEANS= MedianAge MedianHHInc AvgHHInc AvgHHEarnings AvgHHSocSec AvgHHRetInc AvgHHSuppSecInc AvgHHPubAssist MedianFamInc AvgFamInc PCI MedianNonFamInc AvgNonFamInc MedianEarnings MedianEarningsMale MedianEarningsFemale AvgCommute AvgHHSize AvgFamSize UMPartnerHHsPerK UnmarriedGivingBirthPerk GivingBirthPerk BirthRate15_19 BirthRate20_34 BirthRate35_50 AvgOwnerHHSize AvgRenterHHSize OwnerVacRate RenterVacRate MobileHomesPerK MedianHValue AvgHValue MedianOwnerCostsMort MedianOwnerCostsNoMort MedianGrossRent AvgGrossRent ; %let ACSMWGTS=TotPop TotHHs TotHHs NumHHEarnings NumHHSocSec NumHHRetInc NumHHSuppSecInc NumHHPubAssist FamHHs FamHHs TotPop NonFamHHs NonFamHHs FullTimeWorkers FullTimeWorkersMale FullTimeWorkersFemale Commuters TotHHs Families TotHHs UnmarriedWomen15to50 Women15to50 Women15to19 Women20to34 Women35to50 OwnerOcc RenterOcc TotalOwnerUnits TotalRentalUnits TotHUs OwnerOcc OwnerOcc HUsMort HUsNoMort CashRenter RenterOcc ; %let MEANSBG= MedianAge MedianHHInc AvgHHInc AvgHHEarnings AvgHHSocSec AvgHHRetInc AvgHHSuppSecInc AvgHHPubAssist MedianFamInc AvgFamInc PCI MedianNonFamInc AvgNonFamInc AvgCommute AvgHHSize AvgFamSize AvgOwnerHHSize AvgRenterHHSize OwnerVacRate ==> newbgvar_formulae.sas <== x cd /pub/data/acs2011/Tools; %let pgm=newbgvar_formulae; filename pgm "&pgm..sas"; *---Develp and test new formulae for deriving variables from the base tables datasets at BG level. We actually do the test run here using the US totals just to see if they work correctly. If it passes that test then we run it against the new bg tables in btabs5yr to see if we can get improved data at the bg level. jgb, Jan, 2013. Resuming work after getting new bg base tables, late April, 2013. Run this job to generate acs2011.usbgupdates 5/2013. That dataset will be used in job tempusbgs to create "temporary" version of the us bg level profiles, enhanced with these new variable defns. Code will be added to the tempusbgs.sas setup to define the Pct variables that use EmployedCLF as the denominator. ---*; %let vintage=2011; %let period=5yr; %let vm4=%eval(&vintage - 4); %let years=&vm4._&vintage; %*let inset=stcnty; *<======================; %let inset=bgs; *<======================; %let outset=newbgvars; **libname basetbls "/pub/data/acs&vintage./basetbls"; libname btabs5yr "/pub/data/acs&vintage/btabs5yr" access=readonly; libname acs "/pub/data/acs&vintage."; libname user "/tmp/scratch/userb"; %let ie=e; *<----variable naming convention being used: i for item or e for estimate. In btabs5yr we used e --; data merged&inset; *---We omit ustabs08 because there is no BG data from this dataset---; ==> old_ustabs00_075yr.sas <== x cd /pub/data/acs2011/Tools; %let pgm=ustabs00_75yr; filename pgm "&pgm..sas"; *--Our attempt to run the sas conversion code generated by bce/gr using mySQL--; *---We convert the mySQL tables to sas datasets in the basetbls directory---; /* script generated by RDBMS2SAS.py on Tue Dec 11 12:10:36 2012 */ options compress=binary; options fullstimer; options set=SASMYL MYWIN417; libname acs mysql user='oseda_reader' password='dataareevil' database='acs_detailedtables_2007_2011' server='oseda-public.missouri.edu' port=3306; libname cwd '/tmp/scratch'; data cwd.ustabs00_075yr ; length geoid $ 40 areaname $ 200 StateID $ 2 StateName $ 40 logrecno 5 B00001i001 5 B00002i001 5 B01001Ai001 5 B01001Ai002 5 B01001Ai003 5 B01001Ai004 5 B01001Ai005 5 B01001Ai006 5 B01001Ai007 5 B01001Ai008 5 B01001Ai009 5 B01001Ai010 5 B01001Ai011 5 B01001Ai012 5 B01001Ai013 5 B01001Ai014 5 B01001Ai015 5 B01001Ai016 5 B01001Ai017 5 B01001Ai018 5 B01001Ai019 5 B01001Ai020 5 B01001Ai021 5 B01001Ai022 5 B01001Ai023 5 B01001Ai024 5 B01001Ai025 5 B01001Ai026 5 B01001Ai027 5 B01001Ai028 5 B01001Ai029 5 B01001Ai030 5 B01001Ai031 5 B01001Bi001 5 B01001Bi002 5 B01001Bi003 5 B01001Bi004 5 B01001Bi005 5 B01001Bi006 5 B01001Bi007 5 B01001Bi008 5 B01001Bi009 5 B01001Bi010 5 B01001Bi011 5 B01001Bi012 5 B01001Bi013 5 B01001Bi014 5 B01001Bi015 5 B01001Bi016 5 B01001Bi017 5 B01001Bi018 5 B01001Bi019 5 B01001Bi020 5 B01001Bi021 5 B01001Bi022 5 B01001Bi023 5 B01001Bi024 5 B01001Bi025 5 B01001Bi026 5 B01001Bi027 5 B01001Bi028 5 B01001Bi029 5 B01001Bi030 5 B01001Bi031 5 B01001Ci001 5 B01001Ci002 5 B01001Ci003 5 B01001Ci004 5 B01001Ci005 5 B01001Ci006 5 B01001Ci007 5 B01001Ci008 5 B01001Ci009 5 B01001Ci010 5 B01001Ci011 5 B01001Ci012 5 B01001Ci013 5 B01001Ci014 5 B01001Ci015 5 B01001Ci016 5 B01001Ci017 5 B01001Ci018 5 B01001Ci019 5 B01001Ci020 5 B01001Ci021 5 B01001Ci022 5 B01001Ci023 5 B01001Ci024 5 B01001Ci025 5 B01001Ci026 5 B01001Ci027 5 B01001Ci028 5 B01001Ci029 5 B01001Ci030 5 ==> proc_contents_basetbls.sas <== x cd /pub/data/acs2011/Tools; %let pgm=proc_contents_basetbls; filename pgm "&pgm..sas"; *---Generate custom proc contents summary report(s) based on basetbls library (ies) ------ jgb, 4-10-13. ---*; libname btabsR '/pub/data/acs2011/revised_basetbls' ; libname btabs '/pub/data/acs2011/basetbls'; %libname(acs2011); %contdir(btabsR,dsn=revised_basetbls) run; %include sascode(notify); ==> tempusbgs.sas <== x cd /pub/data/acs2011/Tools; %let pgm=tempusbgs; filename pgm "&pgm..sas"; /*--Temporary setup to remove BG level data from the usmcdcprofiles5yr dataset and put them in usbgs5yr with many variables dropped that are never available at the BG level. J. Blodgett, OSEDA, Jan, 2013 Enhanced run 5-4-13 with updates from job newbgvar_formulae setup that generated lots of new values where before we had all missing values. E.g. the poverty data. -- */ title "&pgm"; title2 "Job to Temporarily Create a Separate BG data set but with some variables missing"; options compress=yes; libname acs2011 '/pub/data/acs2011'; libname acs (acs2011); libname user '/tmp/scratch/userb'; filename nomatch "&pgm..nomatch.txt"; *---here we write messages indicating geos not matched between acs and sf1---; /* ========================begin comment==================================== *----We break the original usmcdcprofiles5yr dataset into 3 pieces: bgs, tracts and the rest.-----; data usbgsacsTemp(label='Temp blkgrp level data with limited variables' compress=no); retain vintage '2011'; *<===========================; length esriid $12 county $5 tract $7 bg $1; set acs2011.usmcdcprofiles5yr( drop=areaname zcta5 period years geocomp_name geocomp puma placefp FullTimeWorkers--poorOver65_moe ==> test_invoke_dovarsbg.sas <== x cd /pub/data/acs2011/Tools; %let pgm=test_invoke_dovarsbg; filename pgm "&pgm..sas"; *---Test new invoke_dovarsbg module to create extract datasets from basetbls datasets that can be used at the block group level, where we have limited tables. jgb, 11/12. ---*; %let period=5yr; %let vintage=2010; %let vintagem5=%eval(&vintage-5); %let year=&vintagem5 to &vintage; libname basetbls "/pub/data/acs&vintage./basetbls"; libname acs "/pub/data/acs&vintage."; libname user '/tmp/scratch/user'; data merged1; merge basetbls.ustabs00_07&period(in=indata) /* basetbls.ustabs09_16&period basetbls.ustabs17_20&period basetbls.ustabs25_27&period */ acs.allgeos&period(in=ingeos); by geoid; if indata and ingeos; ==> test_newbasetbls.sas <== x cd /pub/data/acs2011/Tools; %let pgm=test_newbasetbls; filename pgm "&pgm..sas"; *---Run some tests to get a feel for access times etc for the newly generated (by GR, 4-4-13) acs base tables. jgb, 4-8-13. ---*; libname btabs11r '/pub/data/acs2011/revised_basetbls' ; libname btabs11 '/pub/data/acs2011/basetbls'; %libname(acs2011); *---Test 1: Can we match to our allgeos data set without extra sorting.---*; data ids1; merge btabs11r.ustabs085yr(keep=state geoid logrecno rename=(logrecno=logrecnor state=stater geoid=geoidr) in=in11r) acs2011.allgeos2007_2011(keep=state geoid sumlev logrecno where=(not(sumlev in('080','140','150'))) in=ingeos); *by state geoid; *if not (in11r and ingeos) then do; if logrecnor ne put(logrecno,z7.) or (geoid ne geoidr) then do; _nomatch+1; if _nomatch le 50 then put / _all_; else abort abend; end; run; ==> tr5yr_basetbls.sas <== x cd /pub/data/acs2011/Tools; %let pgm=tr5yr_basetbls; filename pgm "&pgm..sas"; *---Create the new and improved census tract level base tables data set. Merges data created by Glenn R. in the revised_basetbls temp subdirectory with the selected allgeos data set. A key is to specify shorter variables, with lengths of 4 instead of 8 bytes. Modeled after the bg5yr_basetbls setup which does the same for BGs. For now all we are doing are the complete tract 140-level data. May go back and do 080 later. jgb, 4-11-13. ---*; libname btabsR '/pub/data/acs2011/revised_basetbls' ; libname btabs5yr '/pub/data/acs2011/btabs5yr'; libname btabs '/pub/data/acs2011/basetbls'; %libname(acs2011); options compress=binary; %macro geofltr; *where also state in ('29'); where geoid=:'140'; %mend geofltr; data call_symputs(compress=no); set btabs.btabs5yrmeta; if lowcase(tgrp)='085yr' then tgrp='08'; macname="vars"||tgrp; call symput(macname,trim(vars)); moes=translate(vars,'m','e'); *--the corresponding MOE variable uses lower case m instead of e. So for estimate b00001e1 we have the corr moe as m00001m1 . --; ==> us5yr_basetbls.sas <== x cd /pub/data/acs2011/Tools; %let pgm=us5yr_basetbls; filename pgm "&pgm..sas"; ******IN PROGRESS********************** ; ****NEVER RUN! See instead usbtabs5yr_basetbls.sas **************************************** *---Create the new and improved base tables data sets for larger geos (all but BGs and tracts). Merges data created by Glenn R. in the revised_basetbls temp subdirectory with the selected allgeos data set. Modeled after the tr5yr_basetbls setup which does the same for census tract summaries. jgb, 4-13-13. ---*; libname btabsR '/pub/data/acs2011/revised_basetbls' ; libname btabs5yr '/pub/data/acs2011/btabs5yr'; libname btabs '/pub/data/acs2011/basetbls'; %libname(acs2011); options compress=binary; %macro geofltr; *here state in ('10','11'); *--Delaware and DC for test. Use same filter in step to create ids set above.--; *where state in ('29'); %mend geofltr; data call_symputs(compress=no); set btabs.btabs5yrmeta; if lowcase(tgrp)='085yr' then tgrp='08'; macname="vars"||tgrp; call symput(macname,trim(vars)); moes=translate(vars,'m','e'); *--the corresponding MOE variable uses lower case m instead of e. So for estimate b00001e1 we have the corr moe as m00001m1 . --; macname="moes"||tgrp; call symput(macname,trim(moes)); ==> uscd113slds_allocation.sas <== x cd /pub/data/acs2011/Tools; %let pgm=uscd113slds_allocation; filename pgm "&pgm..sas"; *---Allocate tract level data from the 2007-2011 ACS period estimates to 113th CDs and new SLDs using equivalency file from MABLE/Geocorr12. We do only the standard extract/profiles data, NOT the base/details. We do not attempt to aggregate the moe values for now. No PR data. J. Blodgett, OSEDA, under contract with the Mo Census Data Center. NOTE: The value of totpopsf1 on the acs2011.ustracts5yr dataset is missing for tracts that have changed since 2010. This will cause the value of pop10 on these cd113 datasets to be short by the sum of the pops of those tracts. Jan., 2013 ---*; filename clistin '/pub/data/corrlst/uszip20102tract.csv'; libname acs2011 '/pub/data/acs2011'; libname mable12 '/pub/data/mable12'; libname user '/tmp/scratch/user'; ***libname sasctlgs clear; libname sasctlgs "/pub/sasctlgs/v9"; /* ========================begin comment==================================== proc format library=mable12; %include '/pub/sasfmats/Str10edt.sas'/source2 ; run; *---this format defines a lookup table used to replace some NY tracts codes to their "2011" equivalents as now being used with the 2011 vintage ACS tract level data.--; ==========================end comment====================================== */ options fmtsearch=(mable12 sasctlgs work); ==> usmcdcprofiles.sas <== /* script generated by RDBMS2SAS.py on Thu Sep 20 11:06:37 2012 */ options compress=binary; options set=SASMYL MYWIN417; libname acs mysql user='oseda_reader' password='dataareevil' database='acs' server='oseda-public.missouri.edu' port=3306; libname cwd '/web/mcdc1/scripts2/acs/2011/acsprofiles/sas_datasets'; proc sql; create table cwd.usmcdcprofiles as select * from acs.usmcdcprofiles_2011 ; quit; data cwd.usmcdcprofiles(label='MCDC Profile extract for all US areas with 65,000+ population based on 2011 surveys'); length geoid $ 20 sumlevel $ 3 areaname $ 200 component_descr $ 160 state $ 2 component $ 2 county $ 5 puma $ 5 cbsa $ 5 placefp $ 5 metrodiv $ 5 DateCreated 8 TotPop 5 TotPop_moe 5 Age0_4 5 pctAge0_4 4 Age0_4_moe 5 Age5_9 5 pctAge5_9 4 Age5_9_moe 5 Age10_14 5 pctAge10_14 4 Age10_14_moe 5 Age15_19 5 pctAge15_19 4 Age15_19_moe 5 Age20_24 5 pctAge20_24 4 Age20_24_moe 5 Age25_34 5 pctAge25_34 4 Age25_34_moe 5 Age35_44 5 pctAge35_44 4 Age35_44_moe 5 Age45_54 5 pctAge45_54 4 Age45_54_moe 5 Age55_59 5 pctAge55_59 4 Age55_59_moe 5 Age60_64 5 pctAge60_64 4 Age60_64_moe 5 Age65_74 5 pctAge65_74 4 Age65_74_moe 5 Age75_84 5 pctAge75_84 4 Age75_84_moe 5 Over85 5 pctOver85 4 Over85_moe 5 MedianAge 4 MedianAge_moe 4 Over5 5 pctOver5 4 Over5_moe 5 Over15 5 pctOver15 4 Over15_moe 5 Under18 5 pctUnder18 4 Under18_moe 5 Over18 5 pctOver18 4 Over18_moe 5 Over21 5 pctOver21 4 Over21_moe 5 Over25 5 pctOver25 4 Over25_moe 5 Over62 5 pctOver62 4 Over62_moe 5 Over65 5 pctOver65 4 Over65_moe 5 Males 5 pctMales 4 Males_moe 5 Over18Males 5 pctOver18Males 4 Over18Males_moe 5 Over65Males 5 pctOver65Males 4 Over65Males_moe 5 Females 5 ==> ustabs00_075yr.sas <== x cd /pub/data/acs2011/Tools; %let pgm=ustabs00_075yr; filename pgm "&pgm..sas"; *----A version of this setup run under the name ustabs00_75yr.sas, run 12-12 and caused the platform to crash! Do not attempt to run this - of historic interest only !!!!!!!!!!! ---; *--Our attempt to run the sas conversion code generated by bce/gr using mySQL--; *---We convert the mySQL tables to sas datasets in the basetbls directory---; /* script generated by RDBMS2SAS.py on Tue Dec 11 12:10:36 2012 */ options compress=binary; options fullstimer; options set=SASMYL MYWIN417; libname acs mysql user='oseda_reader' password='dataareevil' database='acs_detailedtables_2007_2011' server='oseda-public.missouri.edu' port=3306; *libname acs1 mysql user='oseda_reader' password='dataareevil' database='acs_import_2007_2011' server='oseda-archive.missouri.edu' port=3306; libname acs1 mysql user='oseda_reader' password='dataareevil' database='acs_import_2007_2011' server='oseda-public.missouri.edu' port=3306; libname cwd '/tmp/scratch/userb'; libname btabs11 '/pub/data/acs2011/basetbls'; data cwd.ustabs00_075yr ; options nosource; length geoid $ 40 areaname $ 200 StateID $ 2 StateName $ 40 logrecno 5 B00001i001 5 B00002i001 5 B01001Ai001 5 B01001Ai002 5 B01001Ai003 5 B01001Ai004 5 B01001Ai005 5 B01001Ai006 5 B01001Ai007 5 B01001Ai008 5 B01001Ai009 5 B01001Ai010 5 B01001Ai011 5 B01001Ai012 5 B01001Ai013 5 B01001Ai014 5 B01001Ai015 5 B01001Ai016 5 B01001Ai017 5 B01001Ai018 5 B01001Ai019 5 B01001Ai020 5 B01001Ai021 5 B01001Ai022 5 B01001Ai023 5 B01001Ai024 5 B01001Ai025 5 B01001Ai026 5 B01001Ai027 5 B01001Ai028 5 B01001Ai029 5 B01001Ai030 5 B01001Ai031 5 B01001Bi001 5 ==> ustabs5yr_basetbls.sas <== x cd /pub/data/acs2011/Tools; %let pgm=ustabs5yr_basetbls; filename pgm "&pgm..sas"; *---Create the new and improved base tables data sets for many different geo levels. Merges data created by Glenn R. in the revised_basetbls temp subdirectory with the selected allgeos data set. A key is to specify shorter variables, with lengths of 5 instead of 8 bytes. Modeled after the bg5yr_basetbls setup which does the same for BGs. jgb, 4-16-13. Reran the uszcta5 tables to fix problem with blank zcta5 vars 6-24-13. ---*; libname btabsR '/pub/data/acs2011/revised_basetbls' ; libname btabs5yr '/pub/data/acs2011/btabs5yr'; libname btabs '/pub/data/acs2011/basetbls'; %libname(acs2011); libname user '/tmp/scratch/userb'; options compress=binary; %macro geofltr; *where state in ('29'); %mend geofltr; * libname sasctlgs clear; * libname sasctlgs '/pub/sasctlgs/v9'; %*** include '/pub/sasfmats/Szipname.sas'; run; data call_symputs(compress=no); set btabs.btabs5yrmeta; ==> variables_missing.sas <== x cd /pub/data/acs2011/Tools; %let pgm=variables_missing; filename pgm "&pgm..sas"; *---Look at counts of missing values for the mcdcprofiles variables to see what variables could we provide more data for by changing the base tables being used to derive them. jgb, 9/13. ---*; %let vintage=2011; %let period=5yr; %let vm4=%eval(&vintage - 4); %let years=&vm4._&vintage; %*let inset=stcnty; *<======================; libname acs "/pub/data/acs&vintage"; title "&pgm : Report on # of Missing Values for MCDC Profile Variables (All levels single-year)"; title2 "Minimum of 50 Missing Values (Out of 7400+ Total Obs on usmcdcprofiles data set)"; /* ========================begin comment==================================== ==========================end comment====================================== */ data acs.&pgm; *set acs.ustracts5yr(drop=pct: where=(state='06') ) end=last; set acs.usmcdcprofiles( drop=pct: %varlist(*_moe,acs2011.usmcdcprofiles)) end=last; array acsvars(*) age0_4 -- cashrenterOver750; array nmissing (500) _temporary_; do i=1 to dim(acsvars); if acsvars[i]=. then nmissing[i} +1; end; if not last then delete; ==> Variables.sas <== /* script generated by RDBMS2SAS.py on Wed Jan 26 15:13:32 2011 */ options compress=binary; options set=SASMYL MYWIN417; libname metadata mysql user='oseda_reader' password='dataareevil' database='metadata' server='oseda-public.missouri.edu' port=3306; libname cwd '/web/mcdc1/scripts2/acs/2009/acsprofiles/sas_datasets'; proc sql; create table cwd.Variables as select distinct a.variable_name, a.variable_descr, b.definition, b.comments, (case when a.variable_format='%d' then 'comma9.' when a.variable_format='$ %d' then 'dollar9.' when a.variable_format='%4.1f' then '4.1' when a.variable_format='%5.1f' then '5.1' when a.variable_format='%5.2f' then '5.2' else a.variable_format end) as variable_format, d.universe_descr, u.variable_name as UnivVar, w.variable_name as WtVar, a1.variable_name as percent_variable, b1.definition as percent_definition, a2.variable_name as moe_variable, b2.definition as moe_definition, a.indent_level, d.subject_title, d.subject_id, '' as keywords, '2009' as year,