/******************************************************************************* Updates to Margo Schlanger, Trends in Prisoner Litigation, as the PLRA Enters Adulthood, 5 U.C. Irvine L. Rev. 153 (2015) Part 4: Appending, Reformatting, and Keeping Only Select Facility ID, Population, and Court Order Variables from Multiple Bureau of Justice Statistics (BJS) Jail and Prison Census Data Files for 1983-2006 Jail surveys are from 1983, 1988, 1993, 1999, and 2006. Jail files were downloaded from the BJS National Jail Census Series, via ICPSR (https://www.icpsr.umich.edu/web/NACJD/series/68) in April 2021. All but the 1993 survey were available to download as Stata data files; see do file named "04a Data Conversion 1993 Jail Census.do" for code to convert that particular file. Prison surveys are from 1984, 1990, 1995, 2000, and 2005. Prison files were downloaded from the BJS Census of State and Federal Adult Correctional Facilities Series, via ICPSR (https://www.icpsr.umich.edu/web/NACJD/series/67) in April 2021. All but the 1990 and 1995 surveys were available to download as Stata data files; see do files named "04b Data Conversion 1990 Prison Census.do" and "04c Data Conversion 1995 Prison Census.do" for code to convert those respective files. Updated: April 25, 2021 *******************************************************************************/ global project "C:\Users\gmarquez\Box\Empirical Research Service\Margo Schlanger\Empirical Research Service" ******************************************************************************** /* National Jail Census, 1983 */ cd "$project\Census of Jails\National Jail Census 1983" clear use "08203-0001-Data.dta", clear gen double id = . format id %17.0g replace id = V11 + (V15*10) + (V9*10000) + (V8*100000) + (V7*100000000) /// + (V6*100000000000) + (V5*1000000000000) order id, first tostring id, gen (id_string) format(%17.0g) replace id_string = "0" + id_string if length(id_string) == 13 gen double jurid=floor(id/100) format jurid %17.0g order jurid, after(id) rename V5 state rename V63 count rename V112 adp gen long popcp = V41 == 2 gen long ord_o = V450 == 2 gen long ordsm = . replace ordsm = 0 replace ordsm = 1 if (popcp == 1 | ord_o == 1) rename V6 gov rename V119 adm rename V42 max gen long prison = 0 gen long s = 1 gen long n = 1 gen year = 1983 gen long fed = 0 /* Standardizing Court Order Summary variable for jurisdiction id copies with different values (i.e., if one jur. id has ordsm==1, then all facilities within that jur. id should have ordsm==1) */ bysort jurid: egen ordmean = mean(ordsm) gen ordcheck = (ordmean>0 & ordmean<1) sort ordcheck jurid replace ordsm = 1 if ordcheck == 1 drop ordmean ordcheck V* tempfile jailcensus1983 save `jailcensus1983' ******************************************************************************** /* National Jail Census, 1988 */ cd "$project\Census of Jails\National Jail Census 1988" clear use "09256-0001-Data.dta", clear gen double id = V11 + (V10*10000) + (V9*100000) + (V8*100000000) /// + (V7*100000000000) + (V6*1000000000000) format id %17.0g order id, first tostring id, gen (id_string) format(%17.0g) replace id_string = "0" + id_string if length(id_string) == 13 gen double jurid = floor(id/100) format jurid %17.0g order jurid, after(id) rename V6 state rename V78 count rename V216 adp gen long popcp = V38 == 2 gen long ord_o = V40 == 2 gen long order = 0 replace order = 1 if V41 == 1 | V42 == 1 | V43 == 1 | V44 == 1 | V45 == 1 /// | V46 == 1 | V47 == 1 | V48 == 1 | V49 == 1 | V50 == 1 | V51 == 1 /// | V52 == 1 | V53 == 1 | V54 == 1 | V55 == 1 | V56 == 1 gen long ordsm = 0 replace ordsm = 1 if (popcp == 1 | order == 1) rename V7 gov rename V41 crowd rename V42 rec rename V43 med rename V44 staff rename V45 disc rename V46 food rename V47 class rename V48 libr rename V49 visit rename V50 adseg rename V51 griev rename V52 educ rename V53 fire rename V54 coun rename V55 total rename V56 oth rename V186 adm rename V39 max rename V13 facility replace adp = count if missing(adp) gen long prison = 0 gen long s = 1 gen long n = 1 gen year = 1988 gen long fed = 0 /* Standardizing Court Order Summary variable for jurisdiction id copies with different values (i.e., if one jur. id has ordsm==1, then all facilities within that jur. id should have ordsm==1) */ bysort jurid: egen ordmean = mean(ordsm) gen ordcheck = (ordmean>0 & ordmean<1) sort ordcheck jurid replace ordsm = 1 if ordcheck == 1 drop ordmean ordcheck V* tempfile jailcensus1988 save `jailcensus1988' ******************************************************************************** /* National Jail Census, 1993 */ cd "$project\Census of Jails\National Jail Census 1993" clear use "06648-0001-Data.dta", clear destring V1G V1F V1E V1D V1C V1B V1A, replace gen double id = (V1G/1000) + (V1F*100) + (V1E*10000) + (V1D*100000) /// + (V1C*100000000) + (V1B*100000000000) + (V1A*1000000000000) replace id = ((V1G/1000) + (6*100) + (V1E*10000) + (V1D*100000) /// + (V1C*100000000) + (V1B*100000000000) + (V1A*1000000000000)) if V1F == 9 format id %17.0g order id, first tostring id, gen (id_string) format(%17.0g) replace id_string = "0" + id_string if length(id_string) == 13 gen double jurid = floor(id/100) format jurid %17.0g order jurid, after(id) destring V11, replace gen long use = 0 replace use = 1 if V11 == 1 replace use = 1 if (V11 == 2 & V1F == 6) replace use = 1 if (V11 == 3 & V1F == 9) destring V47 V49 V50 V51 V52 V53 V54 V55 V56 V57 V58 V59 V60 V61 V62 V63 V64 /// V65 V66 V68, replace rename V1A state rename V113B count rename V288B adp gen popcp = . replace popcp = 0 if V47 == 1 replace popcp = 1 if V47 == 2 replace popcp = 3 if V47 == 3 replace popcp = 9 if V47 == 0 gen ord_o = . replace ord_o = 0 if V49 == 1 replace ord_o = 1 if V49 == 2 replace ord_o = 3 if V49 == 3 replace ord_o = 9 if V49 == 9 gen facility = V2 rename V2 add1 rename V3 add2 rename V4 add3 rename V5 add4 rename V6 add5 gen order = . recast long order replace order = 3 if V50 == 3 | V51 == 3 | V52 == 3 | V53 == 3 | V54 == 3 /// | V55 == 3 | V56 == 3 | V57 == 3 | V58 == 3 | V59 == 3 | V50 == 3 /// | V61 == 3 | V62 == 3 | V63 == 3 | V64 == 3 | V65 == 3 | V66 == 3 | V68 == 3 replace order = 1 if V50 == 1 | V51 == 1 | V52 == 1 | V53 == 1 | V54 == 1 /// | V55 == 1 | V56 == 1 | V57 == 1 | V58 == 1 | V59 == 1 | V50 == 1 /// | V61 == 1 | V62 == 1 | V63 == 1 | V64 == 1 | V65 == 1 | V66 == 1 /// | V68 == 1 replace order = 9 if V50 == 9 | V51 == 9 | V52 == 9 | V53 == 9 | V54 == 9 /// | V55 == 9 | V56 == 9 | V57 == 9 | V58 == 9 | V59 == 9 | V50 == 9 /// | V61 == 9 | V62 == 9 | V63 == 9 | V64 == 9 | V65 == 9 | V66 == 99 /// | V68 == 99 gen long ordsm = 0 replace ordsm = 9 if (popcp == 9 | order == 9) replace ordsm = 3 if (popcp == 3 | order == 3) replace ordsm = 1 if (popcp == 1 | order == 1) gen long prison = 0 gen long s = 1 gen long n = 1 gen year = 1993 gen long fed = 0 rename V1B gov rename V248B adm rename V48B max rename V67 ost rename V69 ost2 rename V50 crowd rename V51 rec rename V52 med rename V53 staff rename V54 disc rename V55 food rename V56 class rename V57 libr rename V58 visit rename V59 adseg rename V60 prot rename V61 griev rename V62 educ rename V63 fire rename V64 coun rename V65 total rename V66 oth rename V68 oth2 rename V12 comp destring comp max count adm adp, replace /* Standardizing Court Order Summary variable for jurisdiction id copies with different values (i.e., if one jur. id has ordsm==1, then all facilities within that jur. id should have ordsm==1) */ gen long ordsm_2 = (ordsm == 1 | ordsm == 3 ) bysort jurid: egen ordmean = mean(ordsm_2) gen ordcheck = (ordmean > 0 & ordmean < 1) sort ordcheck jurid replace ordsm_2 = 1 if ordcheck == 1 rename ordsm ordsm_orig rename ordsm_2 ordsm /* Remove Federal Facilities */ keep if gov != 6 /* Note: 1993 counts must be limited to only those facilities/jurisdictions in which 'use' == 1, since some jurisdictions have multiple reports -- only one is ultimately useful. */ keep if use == 1 drop ordmean ordcheck use V* tempfile jailcensus1993 save `jailcensus1993' ******************************************************************************** /* National Jail Census, 1999 */ cd "$project\Census of Jails\National Jail Census 1999" clear use "03318-0001-Data.dta", clear gen double id = (V1F/1000) + (V1E*100) + (V1D*100000) + (V1C*100000000) /// + (V1B*100000000000) + (V1A*1000000000000) format id %17.0g /* Correcting two identical IDs by hand: */ replace id = 5103703700650 if id == 5103703700600 & V178 == 5114 replace id = 5103703700670 if id == 5103703700600 & V178 == 349 order id, first tostring id, gen (id_string) format(%17.0g) replace id_string = "0" + id_string if length(id_string) == 13 gen double jurid = floor(id/100) format jurid %17.0g order jurid, after(id) rename V523 fac1 rename V559 fac2 rename V596 fac3 rename V633 fac4 rename V670 fac5 rename V707 fac6 rename V744 fac7 rename V781 fac8 rename V818 fac9 rename V855 fac10 rename V892 fac11 rename V929 fac12 rename V966 fac13 rename V1003 fac14 rename V1040 fac15 rename V1077 fac16 rename V1114 fac17 rename V1152 fac18 rename V1A state rename V52 count rename V178 adp gen long popcp = . replace popcp = 1 if V182 == 1 replace popcp = 0 if V182 == 2 replace popcp = -9 if (V182 == 9 | V182 == 0) gen long ord_o = . replace ord_o = 1 if V186 == 1 replace ord_o = 0 if V186 == 2 replace ord_o = -9 if (V186 == 9 | V186 == 0) rename V2 facility rename V3 cnty rename V6 add rename V7 city rename V8 st rename V9 zip gen long order = 0 replace order = -9 if (V186 == 0 | V186 == 9) replace order = 1 if (V187 == 1 | V188 == 1 | V189 == 1 | V190 == 1 | V191 == 1 /// | V192 == 1 | V193 == 1 | V194 == 1 |V195 == 1 | V196 == 1 | V197 == 1 /// | V198 == 1 | V199 == 1 | V200 == 1 | V201 == 1 | V202 == 1 | V203 == 1) gen long ordsm = 0 replace ordsm = 1 if (popcp == 1 | order == 1) sort jurid duplicates tag jurid, gen(dupjurid) sort dupjurid jurid rename V14B n /* Removing Federal Jails */ keep if V1B != 6 replace popcp = -9 if (popcp != 1 & V186 == 0) gen long prison = 0 gen long s = 1 gen year = 1999 gen long fed = 0 /* Standardizing Court Order Summary variable for jurisdiction id copies with different values (i.e., if one jur. id has ordsm==1, then all facilities within that jur. id should have ordsm==1) */ bysort jurid: egen ordmean = mean(ordsm) gen ordcheck = (ordmean>0 & ordmean<1) sort ordcheck jurid replace ordsm = 1 if ordcheck == 1 drop ordmean ordcheck V* tempfile jailcensus1999 save `jailcensus1999' ******************************************************************************** /* National Jail Census, 2006 */ cd "$project\Census of Jails\Census of Jail Facilities 2006" clear use "26602-0001-Data.dta", clear rename V1 id_origstr gen id_string = substr(id_origstr,1,16) gen id = id_string destring id, replace format id %25.0g order id id_string id_origstr, first rename V2 facility rename V7 state_abb rename V18 count rename V18F count_flag rename V19 adp rename V19F adp_flag rename V20 n rename V24 popcp rename V24A max rename V25 popyr rename V26 ord_o rename V27 crowd rename V28 rec rename V29 staff rename V30 med rename V31 visit rename V32 food rename V33 libr rename V34 griev rename V35 fire rename V36 disc rename V37 adseg rename V38 relig rename V39 serch rename V40 educ rename V41 coun rename V42 class rename V43 oth rename V43S ost gen long prison = 0 gen year = 2006 gen long fed = 0 gen long s = 1 /* Combining flag missing values for adp_flag */ replace adp_flag = . if adp_flag == 9 /* If capac == . then all capacity variables were missing */ gen capac = . foreach var in V142 V168 V194 V220 V246 V272 V298 V324 V350 V376 V402 V428 V454 { replace capac = 0 if `var' > 0 & capac == . replace capac = capac + `var' if `var' >=0 } /* Fix missing ADP data below */ replace adp = count if adp == -1 /* Constructing gov variable from id */ gen gov = substr(id_string,3,1) destring gov, replace /* Specific Conditions */ local conditions crowd visit relig serch fire med disc griev staff adseg libr rec class food coun educ oth foreach cond of local conditions { replace `cond' = 0 if `cond' == -9 & (ord_o == 0 | ord_o == 1) replace `cond' = 0 if `cond' == . & (ord_o == 0 | ord_o == 1) } /*Court Order for Specific Conditions*/ gen order = 0 replace order = 1 if ord_o == 1 foreach cond of local conditions { replace order = 1 if `cond' == 1 } /*Facility Under Court Order either specific conditions or population cap */ gen ordsm = 0 replace ordsm = 1 if popcp == 1 replace ordsm = 1 if order == 1 /* Dropping Puerto Rican facilities */ drop if state_abb=="PR" drop V* tempfile jailcensus2006 save `jailcensus2006' ******************************************************************************** /* Census of State Adult Correctional Facilities, 1984 */ cd "$project\Census of Correctional Facilities\CSACF 1984" clear use "08444-0001-Data.dta", clear gen double id = (V8*1000) + (7*100000) + (V6*100000000000000) replace id = ((V8*1000) + (200100107*100000) + (V6*100000000000000)) if V6 == 9 format id %25.0g order id, first tostring id, gen (id_string) format(%20.0g) replace id_string = "0" + id_string if length(id_string) == 15 gen double jurid = floor(id/100) format jurid %20.0g order jurid, after(id) rename V6 state gen long count = V55 + V56 + V67 + V68 rename V45 adp gen long popcp = . replace popcp = 1 if V43 == 1 replace popcp = 0 if V43 == 2 /* Question I.F3(B) (V44) Asks to list the maximum number of residents that can be housed in the particular facility *if* the facility is under a court order to limit the number of residents that can be housed. 8 locations answered this question with a number but answered "No" to the previous question (i.e., V43 = 2). Here, we assume that those 8 observations should have their value for V43 changed to "Yes" (i.e., V43 = 1). */ replace popcp = 1 if V44 != 0 gen long ord_o = . replace ord_o = 1 if V714 == 1 replace ord_o = 0 if V714 == 2 gen long order = 0 replace order = 1 if (V714 == 1 | V715 == 1 | V715 == 2 | V715 == 3 /// | V716 == 1 | V716 == 2 | V716 == 3 | V717 == 1 | V717 == 2 /// | V717 == 3 | V718 == 1 | V718 == 2 | V718 == 3 | V719 == 1 /// | V719 == 2 | V719 == 3 | V720 == 1 | V720 == 2 | V720 == 3 /// | V721 == 1 | V721 == 2 | V721 == 3 | V722 == 1 | V722 == 2 /// | V722 == 3 | V723 == 1 | V723 == 2 | V723 == 3 | V724 == 1 /// | V724 == 2 | V724 == 3 | V725 == 1 | V725 == 2 | V725 == 3 /// | V726 == 1 | V726 == 2 | V726 == 3 | V727 == 1 | V727 == 9 /// | V729 == 1 | V729 == 9 | V728 == 1 | V728 == 2 | V728 == 3 /// | V730 == 1 | V730 == 2 | V730 == 3) gen long ordsm = 0 replace ordsm = 1 if (popcp == 1 | order == 1) gen long fed = 0 gen long prison = 1 gen long s = 1 gen long n = 1 gen year = 1984 /* Variable denoting community-based facilities */ gen long community = 0 replace community = 1 if V5 == 42 gen gov = 4 drop V* tempfile prisoncensus1984 save `prisoncensus1984' ******************************************************************************** /* Census of State Adult Correctional Facilities, 1990 */ cd "$project\Census of Correctional Facilities\CSFACF 1990" clear use "09908-0001-Data.dta", clear gen V6string = V6 order V6string, after(V6) destring V5 V8 V6 V12 V77 V93 V62 V43 V45 V46 V47 V48 V49 V50 V51 V52 V53 /// V54 V55 V56 V57 V58 V59 V60 V61, replace gen double id = (V8) + (V6*10000000) format id %20.0g /* Updating Kenosha prison ID: */ replace id = 5000000000734000 if V8 == 734003 order id, first tostring id, gen (id_string) format(%20.0g) replace id_string = "0" + id_string if length(id_string) == 15 gen state = substr(V6string,1,2) order state, after(V6string) destring state, replace gen long count = V77 + V93 rename V62 adp gen long popcp = . replace popcp = 1 if V43 == 1 replace popcp = 0 if V43 == 2 gen long ord_o = . replace ord_o = 1 if V45 == 1 replace ord_o = 0 if V45 == 2 gen long order = 0 replace order = 1 if (V45 == 1 | V46 == 1 | V47 == 1 | V48 == 1 | V49 == 1 /// | V50 == 1 | V51 == 1 | V52 == 1 | V53 == 1 | V54 == 1 | V55 == 1 /// | V56 == 1 | V57 == 1 | V58 == 1 | V59 == 1 | V60 == 1 | V61 == 1) gen long ordsm = 0 replace ordsm = 1 if (popcp == 1 | order == 1) gen long prison = 1 gen long s = 1 gen long n = 1 gen year = 1990 /* Variable denoting community-based facilities */ gen long community = 0 replace community = 1 if V5 == 42 /* Variable denoting federal facilities */ gen long fed = 0 replace fed = 1 if V12 == 1 /* Variable denoting priately managed facilities */ gen long priv = 0 replace priv = 1 if V12 == 3 drop V* tempfile prisoncensus1990 save `prisoncensus1990' ******************************************************************************** /* Census of State and Federal Adult Correctional Facilities, 1995 */ cd "$project\Census of Correctional Facilities\CSFACF 1995" clear use "06953-0001-Data.dta", clear destring V6 V5 V4 V3 V2 V1 V13 V14 V73 V71 V48 V51 V52 V53 V54 V55 V56 V57 /// V58 V59 V60 V61 V62 V63 V64 V65 V66 V67 V68 V70, replace gen double id = (V6) + (V5*100000) + (V4*10000000) + (V3*10000000000) /// + (V2*10000000000000) + (V1*100000000000000) format id %22.0g order id, first tostring id, gen (id_string) format(%20.0g) replace id_string = "0" + id_string if length(id_string) == 15 rename V1 state rename V7 facility rename V73 count rename V71 adp gen long popcp = . replace popcp = 1 if V48 == 1 replace popcp = 0 if V48 == 2 gen long ord_o = . replace ord_o = 1 if V51 == 1 replace ord_o = 0 if V51 == 2 gen long order = 0 replace order = 1 if (V51 == 1 | V52 == 1 | V53 == 1 | V54 == 1 | V55 == 1 /// | V56 == 1 | V57 == 1 | V58 == 1 | V59 == 1 | V60 == 1 | V61 == 1 /// | V62 == 1 | V63 == 1 | V64 == 1 | V65 == 1 | V66 == 1 | V67 == 1 /// | V68 == 1 | V70 == 1) gen long ordsm = 0 replace ordsm = 1 if (popcp == 1 | order == 1) gen long prison = 1 gen long s = 1 gen long n = 1 gen year = 1995 /* Variable denoting community-based facilities: Note: Codebook states that facilities are classified as community-based if 50% or more of inmates are allowed to regularly leave the facility unaccompanied. */ gen long community = 0 replace community = 1 if V14 == 1 /* Variable denoting federal facilities: */ gen long fed = 0 replace fed = 1 if V2 == 6 /* Variable denoting privately operated facilities: */ gen long priv = 0 replace priv = 1 if V13 == 3 rename V9 city rename V10 state_abb rename V11 zip rename V8 addr rename V52 crowd rename V49 max rename V53 med rename V54 adseg rename V55 staff rename V56 food rename V57 educ rename V58 disc rename V59 rec rename V60 visit rename V61 fire rename V62 coun rename V63 class rename V64 libr rename V65 griev rename V66 relig rename V67 serch rename V68 oth rename V69 ost rename V70 total drop V* destring max, replace tempfile prisoncensus1995 save `prisoncensus1995' ******************************************************************************** /* Census of State and Federal Adult Correctional Facilities, 2000 */ cd "$project\Census of Correctional Facilities\CSFACF 2000" clear use "04021-0001-Data.dta", clear rename VID id rename VNAMEFAC facility rename VADDRESS add rename VCITY city rename VSTATE state_abb rename VZIPCODE zip gen long popcp = . replace popcp = 1 if V11A != 0 replace popcp = 0 if V11A == 0 gen long ord_o = . replace ord_o = 1 if V12 == 1 replace ord_o = 0 if V12 == 2 | V12 == 8 gen long total = . replace total = 1 if V12B == 1 replace total = 0 if V12B == 2 | V12B == 0 gen long order = . replace order = 1 if V12 == 1 | V12A01 == 1 | V12A02 == 1 | V12A03 == 1 /// | V12A04 == 1 | V12A05 == 1 | V12A06 == 1 | V12A07 == 1 | V12A08 == 1 /// | V12A09 == 1 | V12A10 == 1 | V12A11 == 1 | V12A12 == 1 | V12A13 == 1 /// | V12A14 == 1 | V12A15 == 1 | V12A16 == 1 | V12A17 == 1 | V12A18 == 1 /// | V12A19 == 1 gen long ordsm = 0 replace ordsm = 1 if (popcp == 1 | order == 1) rename V13 count gen long adp = V18M + V18F rename V12A01 crowd rename V12A02 adseg rename V12A03 disc rename V12A04 griev rename V12A05 serch rename V12A06 staff rename V12A07 food rename V12A08 med rename V12A09 mh rename V12A10 visit rename V12A11 rec rename V12A12 fire rename V12A13 coun rename V12A14 class rename V12A15 libr rename V12A16 relig rename V12A17 educ rename V12A18 disab rename V12A19 oth rename V12A19S ost rename V12C totyr rename V11A max rename V11B popyr rename V23F fed_count /* Variable denoting community-based facilities: */ gen long community = 0 replace community = 1 if V4A8 == 1 /* Variable denoting federal facilities: */ gen long fed = 0 replace fed = 1 if V1 == 1 /* Note: 22 federal facilities are classified as private, state, or DC, facilities by variable V1, but online research and phone calls confirmed they are indeed federal facilities. */ replace fed = 1 if id == "448000000079997300000" replace fed = 1 if id == "098001001071800000000" replace fed = 1 if id == "038011666072200000000" replace fed = 1 if id == "118060666072000000000" replace fed = 1 if id == "058015666072000000000" replace fed = 1 if id == "058015666070200000000" replace fed = 1 if id == "448048666070100000000" replace fed = 1 if id == "092001001070700000000" replace fed = 1 if id == "038000000073100000000" replace fed = 1 if id == "060000000076900000000" replace fed = 1 if id == "338031666070400000000" replace fed = 1 if id == "058019666071700000000" replace fed = 1 if id == "338031666070200000000" replace fed = 1 if id == "458018666070100000000" replace fed = 1 if id == "448101666071600000000" replace fed = 1 if id == "338031666070300000000" replace fed = 1 if id == "058019666071450000000" replace fed = 1 if id == "018051666072400000000" replace fed = 1 if id == "448223666071500000000" replace fed = 1 if id == "448108666071600000000" replace fed = 1 if id == "058001666071600000000" replace fed = 1 if id == "058037666071800000000" gen long prison = 1 gen long s = 1 gen long n = 1 gen year = 2000 /* Variable denoting privately managed facilities: */ gen long priv = 0 replace priv = 1 if V1 == 5 /* Getting rid of last 5 trailing zeroes in id variable: */ rename id id_origstr gen id_string = substr(id_origstr,1,16) order id_string, before(id_origstr) gen id = id_string destring id, replace format id %20.0g order id, first drop V* CASEID tempfile prisoncensus2000 save `prisoncensus2000' ******************************************************************************** /* Census of State and Federal Adult Correctional Facilities, 2005 */ cd "$project\Census of Correctional Facilities\CSFACF 2005" clear use "24642-0001-Data.dta", clear rename V1 id_origstr gen id_string = substr(id_origstr,1,16) gen id = id_string destring id, replace format id %20.0g order id id_string, first rename V2 facility rename V6 city rename V7 state_abb rename V8 zip rename V9 addr rename V30 community rename V50 popcp rename V51 max rename V52 popyr rename V53 ord_o rename V54 crowd rename V55 visit rename V56 disab rename V57 relig rename V58 mh rename V59 serch rename V60 fire rename V61 med rename V62 disc rename V63 griev rename V64 staff rename V65 adseg rename V66 libr rename V67 rec rename V68 class rename V69 food rename V70 coun rename V71 educ rename V72 oth rename V73 ost rename V74 total rename V75 totyr rename V78 count rename V117 fed_count gen long prison = 1 gen year = 2005 gen long n = 1 gen long s = 1 gen long priv = 0 replace priv = 1 if V21 == 5 gen long fed = 0 replace fed = 1 if V21 == 1 /* Note: facilities with greater than 50% of inmates being held for federal authorities are reclassified as federal facilities. */ gen fed_prop = fed_count/count replace fed_prop = . if count == 9999 replace fed_prop = . if fed_count == 9999 replace fed = 1 if fed_prop >.5 & fed_prop != . /* Calculate total facility ADP from male APD and female ADP */ gen adp = V76 + V77 /* Specific Conditions */ local conditions crowd visit disab relig mh serch fire med disc griev staff adseg libr rec class food coun educ oth /* replacing incorrect missing values for conditions with 0 */ replace total = 0 if total == -9 & (ord_o == 0 | ord_o == 1) replace total = 0 if total == . & (ord_o == 0 | ord_o == 1) foreach cond of local conditions { replace `cond' = 0 if `cond' == -9 & (ord_o == 0 | ord_o == 1) replace `cond' = 0 if `cond' == . & (ord_o == 0 | ord_o == 1) } /*Court Order for Specific Conditions*/ gen long order = 0 replace order = 1 if ord_o == 1 foreach cond of local conditions { replace order = 1 if `cond' == 1 } /*Totality of Conditions*/ replace order = 1 if total == 1 /*Facility Under Court Order either specific conditions or population cap */ gen ordsm = 0 replace ordsm = 1 if (popcp == 1 | order == 1) drop V* tempfile prisoncensus2005 save `prisoncensus2005' ******************************************************************************** /* Appending select variables from all surveys and reformatting */ clear append using `jailcensus1983' `jailcensus1988' `jailcensus1993' `jailcensus1999' /// `jailcensus2006' `prisoncensus1984' `prisoncensus1990' `prisoncensus1995' /// `prisoncensus2000' `prisoncensus2005' replace fed = 0 if fed == . replace community = 0 if community == . replace priv = 0 if priv == . replace state = 1 if state_abb == "AL" replace state = 2 if state_abb == "AK" replace state = 3 if state_abb == "AZ" replace state = 4 if state_abb == "AR" replace state = 5 if state_abb == "CA" replace state = 6 if state_abb == "CO" replace state = 7 if state_abb == "CT" replace state = 8 if state_abb == "DE" replace state = 9 if state_abb == "DC" replace state = 10 if state_abb == "FL" replace state = 11 if state_abb == "GA" replace state = 12 if state_abb == "HI" replace state = 13 if state_abb == "ID" replace state = 14 if state_abb == "IL" replace state = 15 if state_abb == "IN" replace state = 16 if state_abb == "IA" replace state = 17 if state_abb == "KS" replace state = 18 if state_abb == "KY" replace state = 19 if state_abb == "LA" replace state = 20 if state_abb == "ME" replace state = 21 if state_abb == "MD" replace state = 22 if state_abb == "MA" replace state = 23 if state_abb == "MI" replace state = 24 if state_abb == "MN" replace state = 25 if state_abb == "MS" replace state = 26 if state_abb == "MO" replace state = 27 if state_abb == "MT" replace state = 28 if state_abb == "NE" replace state = 29 if state_abb == "NV" replace state = 30 if state_abb == "NH" replace state = 31 if state_abb == "NJ" replace state = 32 if state_abb == "NM" replace state = 33 if state_abb == "NY" replace state = 34 if state_abb == "NC" replace state = 35 if state_abb == "ND" replace state = 36 if state_abb == "OH" replace state = 37 if state_abb == "OK" replace state = 38 if state_abb == "OR" replace state = 39 if state_abb == "PA" replace state = 40 if state_abb == "RI" replace state = 41 if state_abb == "SC" replace state = 42 if state_abb == "SD" replace state = 43 if state_abb == "TN" replace state = 44 if state_abb == "TX" replace state = 45 if state_abb == "UT" replace state = 46 if state_abb == "VT" replace state = 47 if state_abb == "VA" replace state = 48 if state_abb == "WA" replace state = 49 if state_abb == "WV" replace state = 50 if state_abb == "WI" replace state = 51 if state_abb == "WY" order _all, sequential order year prison id facility state fed priv community count adp adm ordsm, first format id %20.0g replace addr = add if missing(addr) drop add replace addr = add2 if missing(addr) replace city = add4 if missing(city) replace zip = add5 if missing(zip) drop add1 add2 add3 add4 add5 replace state_abb = st if missing(state_abb) drop st drop dupjurid #delimit ; label define statelabel 1 "Alabama (1)" 2 "Alaska (2)" 3 "Arizona (3)" 4 "Arkansas (4)" 5 "California (5)" 6 "Colorado (6)" 7 "Connecticut (7)" 8 "Delaware (8)" 9 "District of Columbia" 10 "Florida (10)" 11 "Georgia (11)" 12 "Hawaii (12)" 13 "Idaho (13)" 14 "Illinois (14)" 15 "Indiana (15)" 16 "Iowa (16)" 17 "Kansas (17)" 18 "Kentucky (18)" 19 "Louisiana (19)" 20 "Maine (20)" 21 "Maryland (21)" 22 "Massachusetts (22)" 23 "Michigan (23)" 24 "Minnesota (24)" 25 "Mississippi (25)" 26 "Missouri (26)" 27 "Montana (27)" 28 "Nebraska (28)" 29 "Nevada (29)" 30 "New Hampshire (30)" 31 "New Jersey (31)" 32 "New Mexico (32)" 33 "New York (33)" 34 "North Carolina (34)" 35 "North Dakota (35)" 36 "Ohio (36)" 37 "Oklahoma (37)" 38 "Oregon (38)" 39 "Pennsylvania (39)" 40 "Rhode Island (40)" 41 "South Carolina (41)" 42 "South Dakota (42)" 43 "Tennessee (43)" 44 "Texas (44)" 45 "Utah (45)" 46 "Vermont (46)" 47 "Virginia (47)" 48 "Washington (48)" 49 "West Virginia (49)" 50 "Wisconsin (50)" 51 "Wyoming (51)", replace ; #delimit cr label values state statelabel label var year "Census year" label var prison "Whether facility is prison (1) or jail (0)" label var id "Numerical facility ID w/o leading or trailing zeroes" label var facility "Facility name" label var state "Numerical state variable" label var fed "Federal facility" label var priv "Privately managed facility" label var community "Community-based facility" label var count "Single-day count of facility population" label var adp "Average Daily Population" label var adm "Estimated Annual Admissions" label var ordsm "Whether any court order filed against facility" label var addr "Facility address" label var adp_flag "ADP flag" label var adseg "Ad seg court order" label var capac "Facility housing capacity" label var city "Facility city" label var class "Classification court order" label var cnty "Facility county" label var comp "Complete info?" label var coun "Counseling court order" label var count_flag "Single-day count flag" label var crowd "Crowding court order" label var disab "Disability court order" label var disc "Discipline court order" label var educ "Education court order" label var fac1 "1st facility name (if multiple)" label var fac2 "2nd facility name (if multiple)" label var fac3 "3rd facility name (if multiple)" label var fac4 "4th facility name (if multiple)" label var fac5 "5th facility name (if multiple)" label var fac6 "6th facility name (if multiple)" label var fac7 "7th facility name (if multiple)" label var fac8 "8th facility name (if multiple)" label var fac9 "9th facility name (if multiple)" label var fac10 "10th facility name (if multiple)" label var fac11 "11th facility name (if multiple)" label var fac12 "12th facility name (if multiple)" label var fac13 "13th facility name (if multiple)" label var fac14 "14th facility name (if multiple)" label var fac15 "15th facility name (if multiple)" label var fac16 "16th facility name (if multiple)" label var fac17 "17th facility name (if multiple)" label var fac18 "18th facility name (if multiple)" label var fed_count "Count of inmates housed for federal authorities" label var fed_prop "Proportion of facility inmates that are federal prisoners" label var fire "Fire safety court order" label var food "Food/hygiene court order" label var gov "Government level in charge of facility" label var griev "Grievance court order" label var id_origstr "Facility ID string with original formatting" label var id_string "Facility ID string with trailing zeroes removed" label var jurid "(Jail census only) Jurisdiction ID, created from facility ID" label var libr "Library court order" label var max "Court-imposed population maximum" label var med "Medical court order" label var mh "Mental health court order" label var n "Number of facilities represented by record" label var ord_o "Conditions court order - original BJS summary" label var order "Non population cap court order" label var ordsm_orig "(1993 only) Original court order summary variable" label var ost "Other court order description" label var ost2 "Other court order 2 description" label var oth "Other court order" label var oth2 "Other court order 2" label var popcp "Population cap court order" label var popyr "Year of population cap court order, if any" label var prot "Protective custody court order" label var rec "Recreation court order" label var relig "Religion court order" label var s "survey observations" label var serch "Search court order" label var staff "Staffing court order" label var state_abb "State abbreviation string variable" label var total "Totality court order" label var totyr "Year of totality court order, if any" label var visit "Visiting/mail court order" label var zip "facility zip code" cd "$project\Population and Filings Replication\Data" save "jail_prison_census_court_orders_1983-2006.dta", replace ********************************************************************************