Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions Prog/2018/Innovation for Inclusion/Compile ACS data.sas
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**************************************************************************
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;
geoid= &geo;
run;

proc export data=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);
65 changes: 65 additions & 0 deletions Prog/2018/Innovation for Inclusion/Compile ACS data_06-10.sas
Original file line number Diff line number Diff line change
@@ -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 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.;
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);
32 changes: 32 additions & 0 deletions Prog/2018/Innovation for Inclusion/East of the river flag.sas
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**************************************************************************
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 geoid EOR_tracts;
EOR_tracts = put( geo2010, $Tr1eor. );
geoid = geo2010;
run;

proc export data=EOSflag
outfile="&_dcdata_default_path.\Requests\Prog\2018\Innovation for Inclusion\EastofRiver_flag.csv"
dbms=csv replace;
run;