#delimit; set more off; set autotabgraphs on; cap log close; /* install mmerge before running this file */ /* Final: 12/21/2014 */ /* With variable names updated as needed, 2/19/2015 */ /* This file creates the numbers: next, the _sources file labels sources*/ /*cd "L:\users\bridgesg\Margo\Irvine";*/ cd "L:\Users\mschlan\Data\Pop_and_Filings\"; /******************************************************************************* Section 1: Create population counts for the US and each state, from Census Bureau data. *******************************************************************************/ /* reading in 2000-2009 population estimates */ import excel using "raw_files\CensusPop_2000-2009.xlsx", firstrow clear; replace GeographicArea = subinstr(GeographicArea,".","",1); rename GeographicArea ST_NAME; drop if ST_NAME == "Midwest" | ST_NAME == "Northeast" | ST_NAME == "South" | ST_NAME == "West"; tempfile pop2000_2009; save `pop2000_2009'; /* reading in 2010-2012 population estimates */ import excel using "raw_files\NST_EST2012_ALLDATA.xlsx", firstrow clear; keep Region State Name POPESTIMATE2010 POPESTIMATE2011 POPESTIMATE2012; rename State State_num; rename Name ST_NAME; rename POPESTIMATE2010 PopEst2010; rename POPESTIMATE2011 PopEst2011; rename POPESTIMATE2012 PopEst2012; drop if ST_NAME == "Midwest Region" | ST_NAME == "Northeast Region" | ST_NAME == "South Region" | ST_NAME == "West Region"; replace ST_NAME = "Puerto Rico" if ST_NAME == "Puerto Rico Commonwealth"; mmerge ST_NAME using `pop2000_2009'; sort State_num; drop _merge Region State_num; reshape long PopEst, i(ST_NAME) j(year); rename PopEst pop; gen state = .; replace state = 1 if ST_NAME == "Alabama"; replace state = 2 if ST_NAME == "Alaska"; replace state = 3 if ST_NAME == "Arizona"; replace state = 4 if ST_NAME == "Arkansas"; replace state = 5 if ST_NAME == "California"; replace state = 6 if ST_NAME == "Colorado"; replace state = 7 if ST_NAME == "Connecticut"; replace state = 8 if ST_NAME == "Delaware"; replace state = 9 if ST_NAME == "District of Columbia"; replace state = 10 if ST_NAME == "Florida"; replace state = 11 if ST_NAME == "Georgia"; replace state = 12 if ST_NAME == "Hawaii"; replace state = 13 if ST_NAME == "Idaho"; replace state = 14 if ST_NAME == "Illinois"; replace state = 15 if ST_NAME == "Indiana"; replace state = 16 if ST_NAME == "Iowa"; replace state = 17 if ST_NAME == "Kansas"; replace state = 18 if ST_NAME == "Kentucky"; replace state = 19 if ST_NAME == "Louisiana"; replace state = 20 if ST_NAME == "Maine"; replace state = 21 if ST_NAME == "Maryland"; replace state = 22 if ST_NAME == "Massachusetts"; replace state = 23 if ST_NAME == "Michigan"; replace state = 24 if ST_NAME == "Minnesota"; replace state = 25 if ST_NAME == "Mississippi"; replace state = 26 if ST_NAME == "Missouri"; replace state = 27 if ST_NAME == "Montana"; replace state = 28 if ST_NAME == "Nebraska"; replace state = 29 if ST_NAME == "Nevada"; replace state = 30 if ST_NAME == "New Hampshire"; replace state = 31 if ST_NAME == "New Jersey"; replace state = 32 if ST_NAME == "New Mexico"; replace state = 33 if ST_NAME == "New York"; replace state = 34 if ST_NAME == "North Carolina"; replace state = 35 if ST_NAME == "North Dakota"; replace state = 36 if ST_NAME == "Ohio"; replace state = 37 if ST_NAME == "Oklahoma"; replace state = 38 if ST_NAME == "Oregon"; replace state = 39 if ST_NAME == "Pennsylvania"; replace state = 40 if ST_NAME == "Rhode Island"; replace state = 41 if ST_NAME == "South Carolina"; replace state = 42 if ST_NAME == "South Dakota"; replace state = 43 if ST_NAME == "Tennessee"; replace state = 44 if ST_NAME == "Texas"; replace state = 45 if ST_NAME == "Utah"; replace state = 46 if ST_NAME == "Vermont"; replace state = 47 if ST_NAME == "Virginia"; replace state = 48 if ST_NAME == "Washington"; replace state = 49 if ST_NAME == "West Virginia"; replace state = 50 if ST_NAME == "Wisconsin"; replace state = 51 if ST_NAME == "Wyoming"; replace state = 52 if ST_NAME == "Puerto Rico"; replace state = -1 if ST_NAME == "United States"; save "output_files\population_2000-2012.dta", replace; /******************************************************************************* Section 2: Using the terminations dataset to create a count of filings from each state and at the national level, by year. *******************************************************************************/ /* NEED TO REPLACE PATHWAY BELOW */ use "C:\Users\mschlan\Documents\AO\CivTerm_1970-2012p.dta" if (nos == 550 | nos == 555) & (origin == 1 | origin == 2 | origin == 7), clear; /*use "C:\Users\bridgesg\Desktop\Temp\CivTerm_1970-2012p.dta" if (nos == 550 | nos == 555) & (origin == 1 | origin == 2 | origin == 7), clear;*/ /* generating ussum variable for collapsing */ recode juris (2 = 1) (nonmissing = 0), gen(ussum); label variable ussum "U.S. defendant status"; label define ussum 0 "non-federal defendant (0)" 1 "federal defendant (1)"; label values ussum ussum; contract state fyfiling ussum , zero; reshape wide _freq, i(state fyfiling) j(ussum); rename fyfiling year; rename _freq0 statefi; rename _freq1 fedfi; label variable statefi "Filings with non-federal defendants"; label variable fedfi "Filings with federal defendants"; gen filings = statefi + fedfi; drop if year == 2013 | year < 1970; preserve; collapse (sum) fedfi statefi filings, by(year); gen state = -1; tempfile national_filings; save `national_filings'; restore; append using `national_filings'; /* saving the filings combined by year and state */ save "output_files\filings_1970-2012.dta", replace; /******************************************************************************* Section 3: Create inmate population counts for jails at the state and national level. One data source provides yearly national level counts for 1978, 1982-2012, Another has state level counts for 2000-2012. Another has state level counts for 1970 and 1978 *******************************************************************************/ import excel using "raw_files\jails_1970-2012.xlsx", firstrow clear; rename y* jail*; reshape long jail, i(State) j(year); replace State = ltrim(State); replace State = rtrim(State); replace State = "United States" if State == "Total"; /******************************************************************************* Adding missing jail population counts: These came from BJS by an email. Nashville Oklahoma Erie Co. (NY) 2010 ADP=3,551 2010 ADP=2,100 2011 ADP=3,435 2011 ADP=2,233 2012 ADP=3,435 (est) 2012 ADP=2,089 2012 ADP=1313 *******************************************************************************/ replace jail = jail + 3435 if year == 2012 & State == "Tennessee"; replace jail = jail + 3435 if year == 2011 & State == "Tennessee"; replace jail = jail + 3551 if year == 2010 & State == "Tennessee"; replace jail = jail + 2089 if year == 2012 & State == "Oklahoma"; replace jail = jail + 2333 if year == 2011 & State == "Oklahoma"; replace jail = jail + 2100 if year == 2010 & State == "Oklahoma"; replace jail = jail + 1313 if year == 2012 & State == "New York"; replace jail = 0 if year >=2000 & State == "Connecticut"; replace jail = 0 if year >=2000 & State == "Delaware"; replace jail = 0 if year >=2000 & State == "Hawaii"; replace jail = 0 if year >=2000 & State == "Rhode Island"; replace jail = 0 if year >=2000 & State == "Vermont"; rename State ST_NAME; gen state = .; replace state = 1 if ST_NAME == "Alabama"; replace state = 2 if ST_NAME == "Alaska"; replace state = 3 if ST_NAME == "Arizona"; replace state = 4 if ST_NAME == "Arkansas"; replace state = 5 if ST_NAME == "California"; replace state = 6 if ST_NAME == "Colorado"; replace state = 7 if ST_NAME == "Connecticut"; replace state = 8 if ST_NAME == "Delaware"; replace state = 9 if ST_NAME == "District of Columbia"; replace state = 10 if ST_NAME == "Florida"; replace state = 11 if ST_NAME == "Georgia"; replace state = 12 if ST_NAME == "Hawaii"; replace state = 13 if ST_NAME == "Idaho"; replace state = 14 if ST_NAME == "Illinois"; replace state = 15 if ST_NAME == "Indiana"; replace state = 16 if ST_NAME == "Iowa"; replace state = 17 if ST_NAME == "Kansas"; replace state = 18 if ST_NAME == "Kentucky"; replace state = 19 if ST_NAME == "Louisiana"; replace state = 20 if ST_NAME == "Maine"; replace state = 21 if ST_NAME == "Maryland"; replace state = 22 if ST_NAME == "Massachusetts"; replace state = 23 if ST_NAME == "Michigan"; replace state = 24 if ST_NAME == "Minnesota"; replace state = 25 if ST_NAME == "Mississippi"; replace state = 26 if ST_NAME == "Missouri"; replace state = 27 if ST_NAME == "Montana"; replace state = 28 if ST_NAME == "Nebraska"; replace state = 29 if ST_NAME == "Nevada"; replace state = 30 if ST_NAME == "New Hampshire"; replace state = 31 if ST_NAME == "New Jersey"; replace state = 32 if ST_NAME == "New Mexico"; replace state = 33 if ST_NAME == "New York"; replace state = 34 if ST_NAME == "North Carolina"; replace state = 35 if ST_NAME == "North Dakota"; replace state = 36 if ST_NAME == "Ohio"; replace state = 37 if ST_NAME == "Oklahoma"; replace state = 38 if ST_NAME == "Oregon"; replace state = 39 if ST_NAME == "Pennsylvania"; replace state = 40 if ST_NAME == "Rhode Island"; replace state = 41 if ST_NAME == "South Carolina"; replace state = 42 if ST_NAME == "South Dakota"; replace state = 43 if ST_NAME == "Tennessee"; replace state = 44 if ST_NAME == "Texas"; replace state = 45 if ST_NAME == "Utah"; replace state = 46 if ST_NAME == "Vermont"; replace state = 47 if ST_NAME == "Virginia"; replace state = 48 if ST_NAME == "Washington"; replace state = 49 if ST_NAME == "West Virginia"; replace state = 50 if ST_NAME == "Wisconsin"; replace state = 51 if ST_NAME == "Wyoming"; replace state = 52 if ST_NAME == "Puerto Rico"; replace state = -1 if ST_NAME == "United States"; drop ST_NAME; tempfile jail_pop_1970_2012; save `jail_pop_1970_2012'; /******************************************************************************* Create state inmate population counts for Jails on census years; Create state prison and fed counts for census years; *******************************************************************************/ use "raw_files\jail_and_prison_census_1983-2006", clear; collapse (sum) adp count, by(year prison fed state); preserve; keep if prison == 0; drop prison fed count; rename adp jail_census; label var jail_census "Jail Inmate Population (BJS Census)"; tempfile jail_pop_census; save `jail_pop_census'; restore; keep if prison == 1; drop prison adp; reshape wide count, i(state year) j(fed); rename count0 prison_census; rename count1 fed_census; tempfile prison_fed_pop_census; save `prison_fed_pop_census'; /******************************************************************************* Section 4-A: Create Inmate population counts for Federal Facilities (Private and Non-Private) by State and Nat'l for 1994-2012. *******************************************************************************/ import excel using "raw_files\YearlyPopulationNumbers_199409-201309.xlsx", firstrow sheet("USE THIS") clear; rename Year year; /* removing cases with yearly totals */ drop if FacilityCode == "Total" & FacilityDescription == ""; /* creating variable for private prisons */ replace Priv = 0; replace Priv = 1 if regexm(FacilityDescription," CI *$") == 1; replace Priv = 1 if regexm(FacilityDescription," Ci *$") == 1; /* filling state data from 2013 to other years */ gsort FacilityCode -State; replace State = State[_n-1] if FacilityCode == FacilityCode[_n-1]; /******************************************************************************* Facilities without State Codes: Most of these facilities had been closed prior to 2013, therefor Margo had not provided state location data. *******************************************************************************/ replace State = "PA" if FacilityCode == "ALW" & FacilityDescription == "Allenwood FPC"; replace State = "CA" if FacilityCode == "BRN" & FacilityDescription == "Boron FPC"; replace State = "CA" if FacilityCode == "CAL" & FacilityDescription == "California City Ci"; replace State = "FL" if FacilityCode == "EGL" & FacilityDescription == "Eglin FPC"; replace State = "AZ" if FacilityCode == "ELO" & FacilityDescription == "Eloy Dc"; replace State = "TX" if FacilityCode == "ELP" & FacilityDescription == "El Paso FPC"; replace State = "TX" if FacilityCode == "LIM" & FacilityDescription == "Limestone Dc"; replace State = "TN" if FacilityCode == "MLL" & FacilityDescription == "Millington FPC"; replace State = "NV" if FacilityCode == "NEL" & FacilityDescription == "Nellis FPC"; replace State = "LA" if FacilityCode == "PPR" & FacilityDescription == "Pine Prairie CI"; replace State = "NC" if FacilityCode == "SEY" & FacilityDescription == "Seymour Johnsn FPC"; /* correcting ST_ABB for Puerto Rico */ replace State = "PR" if FacilityCode == "GUA" & FacilityDescription == "Guaynabo MDC"; rename State ST_ABB; gen state = .; replace state = 1 if ST_ABB == "AL"; replace state = 2 if ST_ABB == "AK"; replace state = 3 if ST_ABB == "AZ"; replace state = 4 if ST_ABB == "AR"; replace state = 5 if ST_ABB == "CA"; replace state = 6 if ST_ABB == "CO"; replace state = 7 if ST_ABB == "CT"; replace state = 8 if ST_ABB == "DE"; replace state = 9 if ST_ABB == "DC"; replace state = 10 if ST_ABB == "FL"; replace state = 11 if ST_ABB == "GA"; replace state = 12 if ST_ABB == "HI"; replace state = 13 if ST_ABB == "ID"; replace state = 14 if ST_ABB == "IL"; replace state = 15 if ST_ABB == "IN"; replace state = 16 if ST_ABB == "IA"; replace state = 17 if ST_ABB == "KS"; replace state = 18 if ST_ABB == "KY"; replace state = 19 if ST_ABB == "LA"; replace state = 20 if ST_ABB == "ME"; replace state = 21 if ST_ABB == "MD"; replace state = 22 if ST_ABB == "MA"; replace state = 23 if ST_ABB == "MI"; replace state = 24 if ST_ABB == "MN"; replace state = 25 if ST_ABB == "MS"; replace state = 26 if ST_ABB == "MO"; replace state = 27 if ST_ABB == "MT"; replace state = 28 if ST_ABB == "NE"; replace state = 29 if ST_ABB == "NV"; replace state = 30 if ST_ABB == "NH"; replace state = 31 if ST_ABB == "NJ"; replace state = 32 if ST_ABB == "NM"; replace state = 33 if ST_ABB == "NY"; replace state = 34 if ST_ABB == "NC"; replace state = 35 if ST_ABB == "ND"; replace state = 36 if ST_ABB == "OH"; replace state = 37 if ST_ABB == "OK"; replace state = 38 if ST_ABB == "OR"; replace state = 39 if ST_ABB == "PA"; replace state = 40 if ST_ABB == "RI"; replace state = 41 if ST_ABB == "SC"; replace state = 42 if ST_ABB == "SD"; replace state = 43 if ST_ABB == "TN"; replace state = 44 if ST_ABB == "TX"; replace state = 45 if ST_ABB == "UT"; replace state = 46 if ST_ABB == "VT"; replace state = 47 if ST_ABB == "VA"; replace state = 48 if ST_ABB == "WA"; replace state = 49 if ST_ABB == "WV"; replace state = 50 if ST_ABB == "WI"; replace state = 51 if ST_ABB == "WY"; replace state = 52 if ST_ABB == "PR"; replace state = -1 if ST_ABB == "US"; sort FacilityCode year; /******************************************************************************* creating nationwide counts for federal prisoners (private and non private) *******************************************************************************/ preserve; collapse (sum) NumberofInmates, by(year Priv); reshape wide NumberofInmates, i(year) j(Priv); rename NumberofInmates0 fed_np; rename NumberofInmates1 fed_p; replace fed_np = 0 if fed_np == .; replace fed_p = 0 if fed_p == .; drop if year == 2013; gen state = -1; tempfile fed_pop_national; save `fed_pop_national'; restore; /******************************************************************************* creating State counts for federal prisoners (private and non private) *******************************************************************************/ collapse (sum) NumberofInmates, by(year state Priv); reshape wide NumberofInmates, i(year state) j(Priv); rename NumberofInmates0 fed_np; rename NumberofInmates1 fed_p; replace fed_np = 0 if fed_np == .; replace fed_p = 0 if fed_p == .; drop if year == 2013; /******************************************************************************* Combining nat'l and state counts for federal prisoners (private and non private) *******************************************************************************/ append using `fed_pop_national'; sort state year; label variable fed_np "non-private federal incarcerated population (BOP)"; label variable fed_p "private federal incarcerated population (BOP)"; tempfile fed_pop_1994_2012; save `fed_pop_1994_2012'; /******************************************************************************* Section 4-B: Create Inmate population counts for Federal Facilities by State and Nat'l for 1970-1993. *******************************************************************************/ import excel using "raw_files\BOP-population-stats,1969-1993.xlsx", firstrow sheet("Prepped") clear; rename y*_ADP adp*; /* years 1988 - 1993 are likely Count data */ rename y*_Count count*; rename y*_ count*; reshape long adp count, i(PrisonName State) j(year); replace State = "InTransit" if PrisonName == "In Transit"; replace State = "NIMH" if PrisonName == "National Institute of Mental Health Total"; replace State = "US" if PrisonName == "National data"; rename State ST_ABB; gen state = .; replace state = -3 if ST_ABB == "InTransit"; replace state = -2 if ST_ABB == "NIMH"; replace state = -1 if ST_ABB == "US"; replace state = 1 if ST_ABB == "AL"; replace state = 2 if ST_ABB == "AK"; replace state = 3 if ST_ABB == "AZ"; replace state = 4 if ST_ABB == "AR"; replace state = 5 if ST_ABB == "CA"; replace state = 6 if ST_ABB == "CO"; replace state = 7 if ST_ABB == "CT"; replace state = 8 if ST_ABB == "DE"; replace state = 9 if ST_ABB == "DC"; replace state = 10 if ST_ABB == "FL"; replace state = 11 if ST_ABB == "GA"; replace state = 12 if ST_ABB == "HI"; replace state = 13 if ST_ABB == "ID"; replace state = 14 if ST_ABB == "IL"; replace state = 15 if ST_ABB == "IN"; replace state = 16 if ST_ABB == "IA"; replace state = 17 if ST_ABB == "KS"; replace state = 18 if ST_ABB == "KY"; replace state = 19 if ST_ABB == "LA"; replace state = 20 if ST_ABB == "ME"; replace state = 21 if ST_ABB == "MD"; replace state = 22 if ST_ABB == "MA"; replace state = 23 if ST_ABB == "MI"; replace state = 24 if ST_ABB == "MN"; replace state = 25 if ST_ABB == "MS"; replace state = 26 if ST_ABB == "MO"; replace state = 27 if ST_ABB == "MT"; replace state = 28 if ST_ABB == "NE"; replace state = 29 if ST_ABB == "NV"; replace state = 30 if ST_ABB == "NH"; replace state = 31 if ST_ABB == "NJ"; replace state = 32 if ST_ABB == "NM"; replace state = 33 if ST_ABB == "NY"; replace state = 34 if ST_ABB == "NC"; replace state = 35 if ST_ABB == "ND"; replace state = 36 if ST_ABB == "OH"; replace state = 37 if ST_ABB == "OK"; replace state = 38 if ST_ABB == "OR"; replace state = 39 if ST_ABB == "PA"; replace state = 40 if ST_ABB == "RI"; replace state = 41 if ST_ABB == "SC"; replace state = 42 if ST_ABB == "SD"; replace state = 43 if ST_ABB == "TN"; replace state = 44 if ST_ABB == "TX"; replace state = 45 if ST_ABB == "UT"; replace state = 46 if ST_ABB == "VT"; replace state = 47 if ST_ABB == "VA"; replace state = 48 if ST_ABB == "WA"; replace state = 49 if ST_ABB == "WV"; replace state = 50 if ST_ABB == "WI"; replace state = 51 if ST_ABB == "WY"; replace state = 52 if ST_ABB == "PR"; /******************************************************************************* creating State counts for federal prisoners *******************************************************************************/ collapse (sum) adp count, by(year state); gen fed = .; /* Using Count data for States (1970-1993) */ replace fed = count if state != -1; /* Using Count data for National (1987-1993) */ replace fed = count if state == -1 & year >= 1987; /* Only adp available for National (1970-1986) */ replace fed = adp if state == -1 & year <= 1986; /* Not keeping counts for In Transit and National Institute for Mental Health */ drop if state == -3 | state == -2; drop if year < 1970 | year == 2013; sort state year; keep state year fed; tempfile fed_pop_1970_1993; save `fed_pop_1970_1993'; /******************************************************************************* Section 5: Create Inmate population counts for Prisons at the state and national level. Data provides yearly national and state level counts for 1978-2012. For 1999-2012, these counts are divided into private and non-private facilities. *******************************************************************************/ /* reading in private prison population data (only relevant for 1999-2012) */ import excel using "raw_files\prisons_with_private_1999-2012.xlsx", firstrow allstring clear; foreach var of varlist y* {; replace `var' = "" if `var' == "/"; replace `var' = "" if `var' == "--"; destring `var', replace; }; rename y* prison*; tempfile prison_pop_1999_2012; save `prison_pop_1999_2012'; /* reading in prison population data */ import excel using "raw_files\prisons_1978-2012.xlsx", firstrow clear; rename y* prison*; /* adding in counts for private prisons */ drop prison1999-prison2012; mmerge Jurisdiction using `prison_pop_1999_2012'; drop _merge; reshape long prison, i(Jurisdiction) j(year); /* Creating National counts for Federal prisoners and State Prisoners */ preserve; keep if Jurisdiction == "Federal" | Jurisdiction == "State"; gen fed = 0; replace fed = 1 if Jurisdiction == "Federal"; replace Jurisdiction = "U.S. Total"; reshape wide prison, i(year) j(fed); rename prison0 prison; rename prison1 fed; tempfile national_fed_pop_1978_2012; save `national_fed_pop_1978_2012'; restore; /* removing old national counts */ drop if Jurisdiction == "U.S. total" | Jurisdiction == "Federal" | Jurisdiction == "State"; /* adding back the National counts, separated by Fed/nonFed */ mmerge year Jurisdiction using `national_fed_pop_1978_2012'; drop _merge; /* adjusting State variable for merge with Jail data */ rename Jurisdiction ST_NAME; replace ST_NAME = ltrim(ST_NAME); replace ST_NAME = rtrim(ST_NAME); replace ST_NAME = "United States" if ST_NAME == "U.S. Total"; gen state = .; replace state = 1 if ST_NAME == "Alabama"; replace state = 2 if ST_NAME == "Alaska"; replace state = 3 if ST_NAME == "Arizona"; replace state = 4 if ST_NAME == "Arkansas"; replace state = 5 if ST_NAME == "California"; replace state = 6 if ST_NAME == "Colorado"; replace state = 7 if ST_NAME == "Connecticut"; replace state = 8 if ST_NAME == "Delaware"; replace state = 9 if ST_NAME == "District of Columbia"; replace state = 10 if ST_NAME == "Florida"; replace state = 11 if ST_NAME == "Georgia"; replace state = 12 if ST_NAME == "Hawaii"; replace state = 13 if ST_NAME == "Idaho"; replace state = 14 if ST_NAME == "Illinois"; replace state = 15 if ST_NAME == "Indiana"; replace state = 16 if ST_NAME == "Iowa"; replace state = 17 if ST_NAME == "Kansas"; replace state = 18 if ST_NAME == "Kentucky"; replace state = 19 if ST_NAME == "Louisiana"; replace state = 20 if ST_NAME == "Maine"; replace state = 21 if ST_NAME == "Maryland"; replace state = 22 if ST_NAME == "Massachusetts"; replace state = 23 if ST_NAME == "Michigan"; replace state = 24 if ST_NAME == "Minnesota"; replace state = 25 if ST_NAME == "Mississippi"; replace state = 26 if ST_NAME == "Missouri"; replace state = 27 if ST_NAME == "Montana"; replace state = 28 if ST_NAME == "Nebraska"; replace state = 29 if ST_NAME == "Nevada"; replace state = 30 if ST_NAME == "New Hampshire"; replace state = 31 if ST_NAME == "New Jersey"; replace state = 32 if ST_NAME == "New Mexico"; replace state = 33 if ST_NAME == "New York"; replace state = 34 if ST_NAME == "North Carolina"; replace state = 35 if ST_NAME == "North Dakota"; replace state = 36 if ST_NAME == "Ohio"; replace state = 37 if ST_NAME == "Oklahoma"; replace state = 38 if ST_NAME == "Oregon"; replace state = 39 if ST_NAME == "Pennsylvania"; replace state = 40 if ST_NAME == "Rhode Island"; replace state = 41 if ST_NAME == "South Carolina"; replace state = 42 if ST_NAME == "South Dakota"; replace state = 43 if ST_NAME == "Tennessee"; replace state = 44 if ST_NAME == "Texas"; replace state = 45 if ST_NAME == "Utah"; replace state = 46 if ST_NAME == "Vermont"; replace state = 47 if ST_NAME == "Virginia"; replace state = 48 if ST_NAME == "Washington"; replace state = 49 if ST_NAME == "West Virginia"; replace state = 50 if ST_NAME == "Wisconsin"; replace state = 51 if ST_NAME == "Wyoming"; replace state = 52 if ST_NAME == "Territories (PR, VI, CZ, Guam, NMI)"; replace state = -1 if ST_NAME == "United States"; /* replacing missing DC data */ replace prison = 0 if state == 9 & prison == .; /******************************************************************************* Section 6: Combining Prison with Jail and Fed Inmate populations. *******************************************************************************/ /* Adding state prison data for 1970-1977*/ append using "raw_files/State-Prison-1970-1977-revised.dta"; label values state STATE; /* adding state by state federal prison counts for 1970 - 1993*/ merge 1:1 state year using `fed_pop_1970_1993', update replace; replace fed = 0 if year <= 1993 & _merge == 1; drop _merge; /* adding state by state federal prison counts for 1994 - 2012 */ merge 1:1 state year using `fed_pop_1994_2012'; drop _merge; replace fed_np = 0 if fed_np == . & year >= 1994; replace fed_p = 0 if fed_p == . & year >= 1994; /* adding state jail inmate populations for census years */ merge 1:1 state year using `prison_fed_pop_census'; drop _merge; /* Merging Prison population data with the Jail data */ merge 1:1 state year using `jail_pop_1970_2012'; drop _merge; /* adding state jail inmate populations for census years */ merge 1:1 state year using `jail_pop_census'; drop _merge; /* labeling variables used for filling in gaps in data */ label var fed_census "Federal Inmate Population (BJS Census)"; label var prison_census "State Prison Inmate Population (BJS Census)"; label var jail_census "Jail Inmate Population (BJS Census)"; /* filling in missing Federal inmate counts */ replace fed = fed_np + fed_p if fed == .; replace fed = fed_census if fed == .; label var fed "Federal Incarcerated Population (see notes)"; /* filling in missing prison inmate counts */ replace prison = prison_census if prison == .; label var prison "State Prison Population (see notes)"; /* Correcting missing values to 0's for states without jails in Census years */ foreach year of numlist 1983 1988 1993 1999 2006 {; /* connecticut (7) */ replace jail_census = 0 if state == 7 & year == `year' & jail_census == .; /* delaware (8) */ replace jail_census = 0 if state == 8 & year == `year' & jail_census == .; /* hawaii (12) */ replace jail_census = 0 if state == 12 & year == `year' & jail_census == .; /* rhode island (40) */ replace jail_census = 0 if state == 40 & year == `year' & jail_census == .; /* vermont (46) */ replace jail_census = 0 if state == 46 & year == `year' & jail_census == .; }; /* filling in missing jail inmate counts */ replace jail = jail_census if jail == .; label var jail "Jail Population (see notes)"; /* saving the federal, prison, and jail populations by state and year */ save "output_files\inmate_population_1970-2012.dta", replace; /******************************************************************************* Section 7: Combining Inmate Populations, Filings, and Census Population *******************************************************************************/ use "output_files\inmate_population_1970-2012.dta", clear; mmerge state year using "output_files\filings_1970-2012.dta"; mmerge state year using "output_files\population_2000-2012.dta"; drop _merge; /******************************************************************************* Dropping the variables used to fill in fed, prison, and jail to make the final dataset easier to work with *******************************************************************************/ drop ST_NAME fed_np fed_p fed_census prison_census jail_census; sort state year; tempfile new_population_and_filings; save `new_population_and_filings'; /******************************************************************************* Source: Jail Inmates at Midyear 2013 - Statistical Tables Available at: http://www.bjs.gov/content/pub/pdf/jim13st.pdf (May 2014, NCJ 245350) Table 7 Average daily jail population, admissions, and turnover rate, by size of jurisdiction, week ending June 30, 2012 and 2013 Not doing this because the 2012 data then came out -- and it's different. Not sure of the source of the difference replace jail = 737369 if state == -1 & year == 2012; *******************************************************************************/ /* Make the missing jail values == 0 where appropriate */ list state if jail == . & year == 1970; replace jail = 0 if jail == . & year == 1970 ; replace jail = 0 if jail == . & year == 1978 ; replace jail = 0 if jail == . & year == 1983 ; replace jail = 0 if jail == . & year == 1993 ; replace jail = 0 if jail == . & year > 1998 & year < 2013; /* Filling in National Jail Counts with estimates for 1971-1977 and 1979 */ replace jail = 160000 if state == -1 & year >= 1971 & year <= 1977; replace jail = 170000 if state == -1 & year == 1979; /* creating temp variable to identify obs estimated with linear interpolation */ gen intrp = (jail == .); label var intrp "Was jail populated using the linear interpolation?"; label define intrp 0 "No (0)" 1 "Yes (1)"; label values intrp intrp; /* Filling in missing Jail data Using a linear interpolation*/ bysort state: ipolate jail year, gen(jail_intrp); replace jail = jail_intrp if jail == .; /* Creating estimate flag for cases with National Jail Counts filled in */ gen estimate = 0; replace estimate = 1 if state == -1 & year >= 1971 & year <= 1977; replace estimate = 2 if state == -1 & year == 1979; replace estimate = 3 if intrp == 1; label define estimate 0 "Not an estimate (0)" 1 "Estimate, based on assumed jail population of 160,000 (1)" 2 "Estimate, based on assumed jail population of 170,000 (2)" 3 "Estimate, based on linear interpolation of known jail data (3)"; label values estimate estimate; gen incar = prison + jail + fed; gen fedFiRate = (1000*fedfi)/fed; gen nonfedFiRate = (1000*statefi)/(prison + jail); gen FiRate = (1000*filings)/(prison + jail + fed); label variable fedFiRate "Fed filing rate per 1000 prisoners (fed)"; label variable nonfedFiRate "Non-Fed filing rate per 1000 prisoners (jail, prison)"; label variable FiRate "Total filing rate per 1000 prisoners (jail, prison, fed)"; /* Note that the territories are left out of the circuits */ gen circuit = . ; replace circuit = 0 if state == 9 ; replace circuit = 1 if state == 20 | state == 22 | state == 30 | state == 40 ; replace circuit = 2 if state == 7 | state == 33 | state == 46 ; replace circuit = 3 if state == 8 | state == 31 | state == 39 ; replace circuit = 4 if state == 21 | state == 34 | state == 41 | state == 47 | state == 49 ; replace circuit = 5 if state == 19 | state == 25 | state == 44 ; replace circuit = 6 if state == 18 | state == 23 | state == 36 | state == 43 ; replace circuit = 7 if state == 14 | state == 15 | state == 50 ; replace circuit = 8 if state == 4 | state == 16 | state == 24 | state == 26 | state == 28 | state == 35 | state == 42 ; replace circuit = 9 if state == 2 | state == 3 | state == 5 | state == 12 | state == 27 | state == 13 | state == 48 | state == 38 | state == 29 ; replace circuit = 10 if state == 6 | state == 17 | state == 32 | state == 37 | state == 45 | state == 51 ; replace circuit = 11 if state == 1 | state == 10 | state == 11 ; /* This is to facilitate export */ format state %40.0g ; gen state_num = state; /******************************************************************************* Section 8: Units, Sources, and Notes. I have incorporated the units, sources, and notes from the revised prison dataset (1970-1977) in the prison section of the syntax below. I'm dropping the old units, sources, and notes so that values are consistent. *******************************************************************************/ drop prison_units prison_source; /******************************************************************************* A. Adding fields for the units/source of the Jail population *******************************************************************************/ gen jail_units = .; replace jail_units = 4 if year == 1970; replace jail_units = 2 if year == 1971 & state == -1; replace jail_units = 2 if year == 1972 & state == -1; replace jail_units = 2 if year == 1973 & state == -1; replace jail_units = 2 if year == 1974 & state == -1; replace jail_units = 2 if year == 1975 & state == -1; replace jail_units = 2 if year == 1976 & state == -1; replace jail_units = 2 if year == 1977 & state == -1; replace jail_units = 3 if year == 1978 & state == -1; replace jail_units = 1 if year == 1978 & state != -1; replace jail_units = 2 if year == 1979 & state == -1; replace jail_units = 1 if year == 1980 & state == -1; replace jail_units = 1 if year == 1981 & state == -1; replace jail_units = 3 if year >= 1982 & state == -1; replace jail_units = 3 if year == 1983 & state != -1; replace jail_units = 3 if year == 1988 & state != -1; replace jail_units = 3 if year == 1993 & state != -1; replace jail_units = 3 if year == 1999 & state != -1; replace jail_units = 3 if year >= 2000 & year <= 2012 & state != -1; replace jail_units = 2 if intrp == 1; label define jail_units 1 "Units from Source Unclear" 2 "Estimate" 3 "ADP" 4 "Count Mar. 15", replace; label values jail_units jail_units; gen jail_source = .; replace jail_source = 1 if year == 1970; replace jail_source = 2 if year == 1971 & state == -1; replace jail_source = 2 if year == 1972 & state == -1; replace jail_source = 2 if year == 1973 & state == -1; replace jail_source = 2 if year == 1974 & state == -1; replace jail_source = 2 if year == 1975 & state == -1; replace jail_source = 2 if year == 1976 & state == -1; replace jail_source = 2 if year == 1977 & state == -1; replace jail_source = 3 if year == 1978; replace jail_source = 5 if year == 1979 & state == -1; replace jail_source = 6 if year == 1980 & state == -1; replace jail_source = 6 if year == 1981 & state == -1; replace jail_source = 7 if year == 1982 & state == -1; replace jail_source = 8 if year >= 1983 & year <= 1987 & state == -1; replace jail_source = 9 if year >= 1988 & year <= 1989 & state == -1; replace jail_source = 10 if year >= 1990 & year <= 1995 & state == -1; replace jail_source = 11 if year >= 1996 & year <= 1999 & state == -1; replace jail_source = 12 if year == 1983 & state != -1; replace jail_source = 13 if year == 1988 & state != -1; replace jail_source = 14 if year == 1993 & state != -1; replace jail_source = 15 if year == 1999 & state != -1; replace jail_source = 16 if year >= 2000 & year <= 2012; label define jail_source 1 "National Jail Census 1970" 2 "Estimate (160,000)" 3 "National Jail Census 1978" 4 "Correctional Pop. in the U.S., 1987" 5 "Estimate (170,000)" 6 "Key Facts at a Glance: Corr. Pop.(2011 version)" 7 "Jail Inmates 1982.pdf (From D.G.)" 8 "Correctional Pop. in the U.S., 1987" 9 "Correctional Pop. in the U.S., 1989" 10 "Correctional Pop. in the U.S., 1996" 11 "Correctional Pop. in the U.S., 1999" 12 "BJS Jail Census 1983" 13 "BJS Jail Census 1988" 14 "BJS Jail Census 1993" 15 "BJS Jail Census 1999" 16 "Mort. in Local Jails & State Prisons, 2000-2012", replace; label values jail_source jail_source; notes jail_source: 1 - Law Enforcement Assistance Admin., U.S. Dep't of Justice, National Jail Census 1970, at 10 tbl.2 (1971); notes jail_source: 2 - Estimate (170,000); notes jail_source: 3 - Law Enforcement Assistance Admin., U.S. Dep't of Justice, Census of Jails and Survey of Jail Inmates 1978, at 3 tbl. 3 (1979) notes jail_source: 4 - Correctional Populations in the U.S., 1987; notes jail_source: 5 - Estimate (170,000); notes jail_source: 6 - Nationwide only: BJS (2011 version, http://bjs.ojp.usdoj.gov/content/glance/tables/corr2tab.cfm); notes jail_source: 7 - Jail Inmates 1982.pdf (email from Daniela Golinelli, Bureau of Justice Statistics); notes jail_source: 8 - Correctional Populations in the U.S., 1987; notes jail_source: 9 - Correctional Populations in the U.S., 1989; notes jail_source: 10 - Correctional Populations in the U.S., 1996; notes jail_source: 11 - Correctional Populations in the U.S., 1999; notes jail_source: 12 - BJS Jail Census 1983; notes jail_source: 13 - BJS Jail Census 1988; notes jail_source: 14 - BJS Jail Census 1993; notes jail_source: 15 - BJS Jail Census 1999; notes jail_source: 16 - Mortality in Local Jails and State Prisons, 2000-2012; notes jail_source; /******************************************************************************* B. Adding fields to label the units/source of the Federal prisoner population *******************************************************************************/ gen fed_units = .; replace fed_units = 1 if year == 1970; replace fed_units = 2 if year >= 1971 & year <= 1974; replace fed_units = 2 if year == 1975; replace fed_units = 2 if year == 1976; replace fed_units = 1 if year == 1977; replace fed_units = 2 if year >= 1978 & state == -1; replace fed_units = 1 if year >= 1977 & year <= 1983 & state != -1; replace fed_units = 2 if year == 1984 & state != -1; replace fed_units = 1 if year >= 1985 & year <= 1989 & state != -1; replace fed_units = 2 if year == 1990 & state != -1; replace fed_units = 1 if year >= 1991 & year <= 1993 & state != -1; replace fed_units = 3 if year >= 1994 & state != -1; label define fed_units 1 "Units from Source Unclear" 2 "As of December 31st" 3 "As of September 31st", replace; label values fed_units fed_units; tab fed_units; gen fed_source = .; *** National sources, to start ; replace fed_source = 1 if year == 1970 & state == -1; replace fed_source = 2 if year >= 1971 & year <= 1974 & state == -1; replace fed_source = 3 if year == 1975 & state == -1; replace fed_source = 4 if year == 1976 & state == -1; replace fed_source = 5 if year == 1977 & state == -1; replace fed_source = 6 if year >= 1978 & year <= 1998 & state == -1; replace fed_source = 7 if year >= 1999 & state == -1; *** state-by-state sources; replace fed_source = 8 if year < 1994 & state != -1; replace fed_source = 9 if year >= 1994 & state != 1; label define fed_source 1 "Prisoners in St & Fed Insts 1968-1970" 2 "Prisoners in St & Fed Insts 12/31/1974" 3 "Prisoners in St & Fed Insts 12/31/1975" 4 "Prisoners in St & Fed Insts 12/31/1977" 5 "Prisoners in St & Fed Insts 12/31/1978" 6 "Inmates St & Fed Corr. 1978-2012 (excl. priv)" 7 "Inmates St & Fed Corr. 1999-2012 (incl. priv)" 8 "Federal BOP, Statistical Report (annual)" 9 "BOP Yearly Population Data", replace; label values fed_source fed_source; notes fed_source: 1 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions: 1968-1970, Nat'l Prisoner Statistics Bull., Apr. 1972, at 22 tbl.10c.; notes fed_source: 2 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions on December 31, 1974, Nat'l Prisoner Statistics Bull., June 1976, at 14 tbl.1.; notes fed_source: 3 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions on December 31, 1975, Nat'l Prisoner Statistics Bull., Feb. 1977, at 36 app. 2, tbl.1.; notes fed_source: 4 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions on December 31, 1977, Nat'l Prisoner Statistics Bull., Feb. 1979, at 10 tbl.1.; notes fed_source: 5 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions on December 31, 1978, Nat'l Prisoner Statistics Bull., Feb. 1979, at 42 tbl. special.; notes fed_source: 6 - Inmates in custody of state or federal correctional facilities, excluding private prison facilities, December 31, 1978-2012; notes fed_source: 7 - Inmates in custody of state or federal correctional facilities, including private prison facilities, December 31, 1999-2012; notes fed_source: 8 - U.S. Dep't of Justice, Federal Bureau of Prisons, Statistical Report (annual), Table A-2 (1970-1986), table 12 (1988/89), table A13 (1990-1993) notes fed_source: 9 - YearlyPopulationNumbers_199409-201309.xlsx, provided by Jennifer Batchelder, BOP Office of Research and Evaluation; /******************************************************************************* C. Adding fields to label the units/source of the State prisoner population *******************************************************************************/ /* Units for 1970-1977 are from Margo's Revised Data */ gen prison_units = .; replace prison_units = 2 if year >= 1970 & year <= 1977; replace prison_units = 2 if year >= 1978; label define prison_units 1 "Units from Source Unclear" 2 "As of December 31st", replace; label values prison_units prison_units; gen prison_source = .; replace prison_source = 1 if year == 1970; replace prison_source = 2 if year >= 1971 & year <= 1973; replace prison_source = 3 if year == 1974; replace prison_source = 4 if year == 1975; replace prison_source = 6 if year == 1976; replace prison_source = 7 if year == 1977; replace prison_source = 8 if year >= 1978 & year <= 1998; replace prison_source = 9 if year >= 1999; label define prison_source 1 "Prisoners in St & Fed Insts 1968-1970" 2 "Prisoners in St & Fed Insts 12/31/1974, p. 14 tbl. 1" 3 "Prisoners in St & Fed Insts 12/31/1974, App. II, p. 36, tbl. 1" 4 "Prisoners in St & Fed Insts 12/31/1975" 5 "Prisoners in St & Fed Insts 12/31/1976" 6 "Prisoners in St & Fed Insts 12/31/1977" 7 "Prisoners in St & Fed Insts 12/31/1978" 8 "Inmates St & Fed Corr. 1978-2012 (excl. priv)" 9 "Inmates St & Fed Corr. 1999-2012 (incl. priv)", replace; label values prison_source prison_source; notes prison_source: 1 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions: 1968-1970, Nat'l Prisoner Statistics Bull., Apr. 1972, at 22 tbl.10c (sentenced prisoners); notes prison_source: 2 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions on December 31, 1974, Nat'l Prisoner Statistics Bull., June 1976, at 14 tbl.1 (mostly sentenced prisoners); notes prison_source: 3 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions on December 31, 1974, Nat'l Prisoner Statistics Bull., June 1976, App. II, at 36 tbl.1 (all prisoners); notes prison_source: 4 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions on December 31, 1975, Nat'l Prisoner Statistics Bull., Feb. 1977, App. II, at 36 tbl.1 (all prisoners); notes prison_source: 5 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions on December 31, 1976, Nat'l Prisoner Statistics Bull., Feb. 1978, at 32 tbl.1 (all prisoners-later corrected, so don't use); notes prison_source: 6 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions on December 31, 1977, Nat'l Prisoner Statistics Bull., Feb. 1979, at 10 tbl.1 (all prisoners, corrected); notes prison_source: 7 - U.S. Dep't of Justice, Prisoners in State and Federal Institutions on December 31, 1978, Nat'l Prisoner Statistics Bull., May 1980, at 42, special tbl. (all prisoners in custody); notes prison_source: 8 - Inmates in custody of state or federal correctional facilities, excluding private prison facilities, December 31, 1978-2012; notes prison_source: 9 - Inmates in custody of state or federal correctional facilities, including private prison facilities, December 31, 1999-2012; des; /******************************************************************************* D. Adding fields to label the units/source of the Population *******************************************************************************/ gen pop_source = .; replace pop_source = 1 if year <= 1979; replace pop_source = 2 if year >= 1980 & year <= 1989; replace pop_source = 3 if year >= 1990 & year <= 1999; replace pop_source = 4 if year >= 2000 & year <= 2009; replace pop_source = 5 if year >= 2010; label define pop_source 1 "Inter-censal est, 1970-1980" 2 "Inter-censal est, 1980-1990" 3 "State Pop Est Annual Time Series 1990-1999" 4 "Annual est, US 2000-2009" 5 "Est Pop 2010-2012", replace; label values pop_source pop_source; notes pop_source : 1 - Table: Intercensal Estimates of the Total Resident Population of States: 1970 to 1980; notes pop_source : 2 - Table: Intercensal Estimates of the Total Resident Population of States: 1980 to 1990; notes pop_source : 3 - Table ST-99-3 State Population Estimates: Annual Time Series, July 1, 1990 to July 1, 1999; notes pop_source : 4 - Annual Estimates of the Resident Population for the United States, Regions, States, and Puerto Rico: April 1, 2000 to July 1, 2009; notes pop_source : 5 - Population, population change, and estimated components of population change: April 1, 2010 to July 1, 2012; sort state year; order state state_num circuit year pop incar prison fed jail filings statefi fedfi nonfedFiRate fedFiRate FiRate estimate jail_intrp intrp prison_units prison_source fed_units fed_source jail_units jail_source pop_source; /* lists all notes for the dataset */ notes; saveold "output_files\population_and_filings_1970-2012.dta", replace;