From d2503b66048b3ffe05775d792b38b1c4f326f474 Mon Sep 17 00:00:00 2001 From: Yipeng Su Date: Fri, 5 Oct 2018 12:30:09 -0400 Subject: [PATCH 1/7] compile ACS and police data --- .../Compile ACS data.sas | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Prog/2018/Innovation for Inclusion/Compile ACS data.sas diff --git a/Prog/2018/Innovation for Inclusion/Compile ACS data.sas b/Prog/2018/Innovation for Inclusion/Compile ACS data.sas new file mode 100644 index 0000000..b5ca32f --- /dev/null +++ b/Prog/2018/Innovation for Inclusion/Compile ACS data.sas @@ -0,0 +1,65 @@ +/************************************************************************** + Program: Commuting time to work.sas + Library: Requests + Project: NeighborhoodInfo DC + Author: Yipeng + Created: 9/19/18 + Version: SAS 9.4 + Environment: Local Windows session + + Description: + +**************************************************************************/ + +%include "L:\SAS\Inc\StdLocal.sas"; + +** Define libraries **; +%DCData_lib( ACS ) +%DCData_lib( NCDB ) +%DCData_lib( police ) + +%let _years=2012_16; + +%macro Compile_ACS_data (geo, geosuf); + +data ACS; +length indicator $80; +set ACS.Acs_2012_16_dc_sum_tr_&geosuf; +keep &geo popaloneb_&_years. popaloneh_2012_16 popalonew_2012_16 popasianpinonhispbridge_2012_16 unemploymentrate PctCol Tothousing ownership pctfamover75K familyhhtot_&_years. pctabovepov pctearningover75K pctchildabovepov pctcostburden commuteunder45 ; +unemploymentrate = popunemployed_&_years./popincivlaborforce_&_years.; +PctCol = pop25andoverwcollege_&_years. / pop25andoveryears_&_years.; +Tothousing= numowneroccupiedhsgunits_&_years.+ numrenteroccupiedhu_&_years.; +ownership= numowneroccupiedhsgunits_&_years./ (numowneroccupiedhsgunits_&_years.+ numrenteroccupiedhu_&_years.); +pctfamover75K= (familyhhtot_&_years.- famincomelt75k_&_years.) /familyhhtot_&_years.; +popabovepov= personspovertydefined_&_years. - poppoorpersons_&_years.; +pctabovepov= popabovepov/personspovertydefined_&_years.; +pctearningover75K=earningover75k_&_years./popemployedworkers_&_years.; +pctchildabovepov = poppoorchildren_&_years./childrenpovertydefined_&_years.; +pctcostburden = (numownercostburden_&_years.+ numrentercostburden_&_years.)/(rentcostburdendenom_&_years.+ ownercostburdendenom_&_years.); +commuteunder45 = (popemployedtravel_lt5_&_years. + popemployedtravel_10_14_&_years.+ popemployedtravel_15_19_&_years.+ popemployedtravel_20_24_&_years. + popemployedtravel_25_29_&_years. )/popemployedworkers_&_years. ; + +run; + + +data violentcrime; +length indicator $80; +set police.crimes_sum_&geosuf; +keep &geo violentcrimerate; +violentcrimerate = crimes_pt1_violent_2017/crime_rate_pop_2017*1000; +run; + +data ACS_&geosuf; +merge ACS violentcrime ; +by &geo +run; + +proc export data=mobility_acs_&geosuf + outfile="&_dcdata_default_path.\Requests\Prog\2018\ACS_data_&geosuf..csv" + dbms=csv replace; + run; + +%mend Compile_ACS_data; + +%Compile_ACS_data (cluster2017, cl17); + +%Compile_ACS_data (geo2010, tr10); From 6f654b7bc9f916afa236189114d210cac26e504b Mon Sep 17 00:00:00 2001 From: Yipeng Su Date: Fri, 5 Oct 2018 16:26:10 -0400 Subject: [PATCH 2/7] bugfix --- Prog/2018/Innovation for Inclusion/Compile ACS data.sas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Prog/2018/Innovation for Inclusion/Compile ACS data.sas b/Prog/2018/Innovation for Inclusion/Compile ACS data.sas index b5ca32f..f11f1ab 100644 --- a/Prog/2018/Innovation for Inclusion/Compile ACS data.sas +++ b/Prog/2018/Innovation for Inclusion/Compile ACS data.sas @@ -50,10 +50,10 @@ run; data ACS_&geosuf; merge ACS violentcrime ; -by &geo +by &geo; run; -proc export data=mobility_acs_&geosuf +proc export data=ACS_&geosuf outfile="&_dcdata_default_path.\Requests\Prog\2018\ACS_data_&geosuf..csv" dbms=csv replace; run; From 9609ac5fa5e56214315b66029389bcd95202e66b Mon Sep 17 00:00:00 2001 From: Yipeng Su Date: Mon, 15 Oct 2018 15:47:00 -0400 Subject: [PATCH 3/7] Create east of the river flag for analysis --- .../Compile ACS data.sas | 1 + .../East of the river flag.sas | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Prog/2018/Innovation for Inclusion/East of the river flag.sas diff --git a/Prog/2018/Innovation for Inclusion/Compile ACS data.sas b/Prog/2018/Innovation for Inclusion/Compile ACS data.sas index f11f1ab..753082e 100644 --- a/Prog/2018/Innovation for Inclusion/Compile ACS data.sas +++ b/Prog/2018/Innovation for Inclusion/Compile ACS data.sas @@ -51,6 +51,7 @@ run; data ACS_&geosuf; merge ACS violentcrime ; by &geo; +geoid= &geo; run; proc export data=ACS_&geosuf diff --git a/Prog/2018/Innovation for Inclusion/East of the river flag.sas b/Prog/2018/Innovation for Inclusion/East of the river flag.sas new file mode 100644 index 0000000..d8b325f --- /dev/null +++ b/Prog/2018/Innovation for Inclusion/East of the river flag.sas @@ -0,0 +1,34 @@ +/************************************************************************** + Program: Commuting time to work.sas + Library: Requests + Project: NeighborhoodInfo DC + Author: Yipeng + Created: 9/19/18 + Version: SAS 9.4 + Environment: Local Windows session + + Description: + +**************************************************************************/ + +%include "L:\SAS\Inc\StdLocal.sas"; + +** Define libraries **; +%DCData_lib( ACS ) + +%let _years=2012_16; + +data EOSflag; +set ACS.Acs_2012_16_dc_sum_tr_tr10; +keep geo2010 EOR_tracts; +if not( missing( put( geo2010, $Tr10_eor. ) ) ) then EOR_tracts = 1; +else EOR_tracts = 0; + +run; + + +proc export data=ACS_&geosuf + outfile="&_dcdata_default_path.\Requests\Prog\2018\EastofRiver_flag.csv" + dbms=csv replace; + run; + From fae320da4bf135069e3ea486a1597963ba3b46ab Mon Sep 17 00:00:00 2001 From: Yipeng Su Date: Mon, 15 Oct 2018 17:52:46 -0400 Subject: [PATCH 4/7] fix format name --- .../Innovation for Inclusion/East of the river flag.sas | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Prog/2018/Innovation for Inclusion/East of the river flag.sas b/Prog/2018/Innovation for Inclusion/East of the river flag.sas index d8b325f..3ddefa4 100644 --- a/Prog/2018/Innovation for Inclusion/East of the river flag.sas +++ b/Prog/2018/Innovation for Inclusion/East of the river flag.sas @@ -21,14 +21,11 @@ data EOSflag; set ACS.Acs_2012_16_dc_sum_tr_tr10; keep geo2010 EOR_tracts; -if not( missing( put( geo2010, $Tr10_eor. ) ) ) then EOR_tracts = 1; -else EOR_tracts = 0; - +EOR_tracts = put( geo2010, $Tr1eor. ); run; - -proc export data=ACS_&geosuf - outfile="&_dcdata_default_path.\Requests\Prog\2018\EastofRiver_flag.csv" +proc export data=EOSflag + outfile="&_dcdata_default_path.\Requests\Prog\2018\Innovation for Inclusion\EastofRiver_flag.csv" dbms=csv replace; run; From 2eeb0774c8127e5dbec777c614b8a7b626305460 Mon Sep 17 00:00:00 2001 From: Yipeng Su Date: Mon, 17 Dec 2018 17:53:41 -0500 Subject: [PATCH 5/7] create east of the river flag --- Prog/2018/Innovation for Inclusion/East of the river flag.sas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Prog/2018/Innovation for Inclusion/East of the river flag.sas b/Prog/2018/Innovation for Inclusion/East of the river flag.sas index 3ddefa4..7dd3891 100644 --- a/Prog/2018/Innovation for Inclusion/East of the river flag.sas +++ b/Prog/2018/Innovation for Inclusion/East of the river flag.sas @@ -20,8 +20,9 @@ data EOSflag; set ACS.Acs_2012_16_dc_sum_tr_tr10; -keep geo2010 EOR_tracts; +keep geo2010 geoid EOR_tracts; EOR_tracts = put( geo2010, $Tr1eor. ); +geoid = geo2010; run; proc export data=EOSflag From 92873d0900e1fb87c734139265cbccd3d3267dd0 Mon Sep 17 00:00:00 2001 From: Yipeng Su Date: Mon, 17 Dec 2018 18:38:48 -0500 Subject: [PATCH 6/7] compile 2006-10 data for cross year comparison --- .../Compile ACS data_06-10.sas | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Prog/2018/Innovation for Inclusion/Compile ACS data_06-10.sas diff --git a/Prog/2018/Innovation for Inclusion/Compile ACS data_06-10.sas b/Prog/2018/Innovation for Inclusion/Compile ACS data_06-10.sas new file mode 100644 index 0000000..3f52693 --- /dev/null +++ b/Prog/2018/Innovation for Inclusion/Compile ACS data_06-10.sas @@ -0,0 +1,65 @@ +/************************************************************************** + Program: Commuting time to work.sas + Library: Requests + Project: NeighborhoodInfo DC + Author: Yipeng + Created: 9/19/18 + Version: SAS 9.4 + Environment: Local Windows session + + Description: + +**************************************************************************/ + +%include "L:\SAS\Inc\StdLocal.sas"; + +** Define libraries **; +%DCData_lib( ACS ) +%DCData_lib( NCDB ) +%DCData_lib( police ) + +%let _years=2006_10; + +%macro Compile_ACS_data (geo, geosuf); + +data ACS; +length indicator $80; +set ACS.Acs_2006_10_dc_sum_tr_&geosuf; +keep &geo popaloneb_&_years. popaloneh_2012_16 popalonew_2012_16 popasianpinonhispbridge_2012_16 unemploymentrate PctCol Tothousing ownership pctfamover75K familyhhtot_&_years. pctabovepov pctearningover75K pctchildabovepov pctcostburden commuteunder45 ; +unemploymentrate = popunemployed_&_years./popincivlaborforce_&_years.; +PctCol = pop25andoverwcollege_&_years. / pop25andoveryears_&_years.; +Tothousing= numowneroccupiedhsgunits_&_years.+ numrenteroccupiedhu_&_years.; +ownership= numowneroccupiedhsgunits_&_years./ (numowneroccupiedhsgunits_&_years.+ numrenteroccupiedhu_&_years.); +pctfamover75K= (familyhhtot_&_years.- famincomelt75k_&_years.) /familyhhtot_&_years.; +popabovepov= personspovertydefined_&_years. - poppoorpersons_&_years.; +pctabovepov= popabovepov/personspovertydefined_&_years.; +pctearningover75K=earningover75k_&_years./popemployedworkers_&_years.; +pctchildabovepov = poppoorchildren_&_years./childrenpovertydefined_&_years.; +pctcostburden = (numownercostburden_&_years.+ numrentercostburden_&_years.)/(rentcostburdendenom_&_years.+ ownercostburdendenom_&_years.); +commuteunder45 = (popemployedtravel_lt5_&_years. + popemployedtravel_10_14_&_years.+ popemployedtravel_15_19_&_years.+ popemployedtravel_20_24_&_years. + popemployedtravel_25_29_&_years. )/popemployedworkers_&_years. ; + +run; + +data violentcrime; +length indicator $80; +set police.crimes_sum_&geosuf; +keep &geo violentcrimerate; +violentcrimerate = crimes_pt1_violent_2010/crime_rate_pop_2010*1000; +run; + +data ACS_&geosuf; +merge ACS violentcrime ; +by &geo; +geoid= &geo; +run; + +proc export data=ACS_&geosuf + outfile="&_dcdata_default_path.\Requests\Prog\2018\ACS_data_&geosuf._06-10.csv" + dbms=csv replace; + run; + +%mend Compile_ACS_data; + +%Compile_ACS_data (cluster2017, cl17); + +%Compile_ACS_data (geo2010, tr10); From ba47d756c31d0f6a70e7b0723b00897514756c3c Mon Sep 17 00:00:00 2001 From: Yipeng Su Date: Tue, 18 Dec 2018 23:16:21 -0500 Subject: [PATCH 7/7] add total population with race info --- Prog/2018/Innovation for Inclusion/Compile ACS data_06-10.sas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Prog/2018/Innovation for Inclusion/Compile ACS data_06-10.sas b/Prog/2018/Innovation for Inclusion/Compile ACS data_06-10.sas index 3f52693..163171a 100644 --- a/Prog/2018/Innovation for Inclusion/Compile ACS data_06-10.sas +++ b/Prog/2018/Innovation for Inclusion/Compile ACS data_06-10.sas @@ -25,7 +25,7 @@ data ACS; length indicator $80; set ACS.Acs_2006_10_dc_sum_tr_&geosuf; -keep &geo popaloneb_&_years. popaloneh_2012_16 popalonew_2012_16 popasianpinonhispbridge_2012_16 unemploymentrate PctCol Tothousing ownership pctfamover75K familyhhtot_&_years. pctabovepov pctearningover75K pctchildabovepov pctcostburden commuteunder45 ; +keep &geo popwithrace_&_years. popaloneb_&_years. popaloneh_&_years. popalonew_&_years. popasianpinonhispbridge_&_years. unemploymentrate PctCol Tothousing ownership pctfamover75K familyhhtot_&_years. pctabovepov pctearningover75K pctchildabovepov pctcostburden commuteunder45 ; unemploymentrate = popunemployed_&_years./popincivlaborforce_&_years.; PctCol = pop25andoverwcollege_&_years. / pop25andoveryears_&_years.; Tothousing= numowneroccupiedhsgunits_&_years.+ numrenteroccupiedhu_&_years.;