******************************
******************************
*********  DATASETS  *********
******************************
******************************

*** Understanding Society: Waves 1-12, 2009-2021 and Harmonised BHPS: Waves 1-18, 1991-2009 ***

* Persistent identifier (DOI): 10.5255/UKDA-SN-6614-18

*** Understanding Society: Waves 1-12, 2009-2021: Special Licence Access, Census 2011 Lower Layer Super Output Areas

* Persistent identifier (DOI): 10.5255/UKDA-SN-7248-12

*** Understanding Society: COVID-19 Study, 2020-2021

* Persistent identifier (DOI): 10.5255/UKDA-SN-8644-11

******************************
******************************
********* BASIC VARS *********
******************************
******************************

clear all
set more off
capture log close

****************************
* Project: SDAI - together and apart
* Data prep, basic vars: Understanding Society waves 1-9
* This version: 15/01/2020 (Magda)
*****************************

/*

variables prepared here:

$base "hidp pno pidp dvage wave country"
$religion "oprlg oprlg1"
$soc(socio-ecnomic status)
$educ "qfhigh_dv"
$wages "jbhas jboff paygu_dv jbhrs jbot istrtdaty istrtdatm month jbstat jshrs jspayu jbsemp"
$wellbeing_satisf "scghq2_dv sclfsato sf12mcs_dv sf12pcs_dv sclfsat2"
age, sex, ethnicity, ethncity boost flag, Ukborn, YearArrivalUK, MigrantGen
cross-sectional weights

output files:
"$results/BaseData.dta"
"$results/FixedVars.dta"
"$results/weights.dta"

*/
	   
* Read indresp data
foreach wave in a b c d e f g h i {
	use "$dirdata\`wave'_indresp", clear
	rename `wave'_* *
	gen wave = index("abcdefghi","`wave'")
	save "$temp\temp_`wave'_indresp", replace
}

* Create individual-level dataset with variables common to all waves (basic socio-demographic variables, earnings)
* (note: time-fixed variablesare merged from xwavedata.dta at a later stage)

global base "hidp pno pidp dvage wave country"
global religion "oprlg oprlg1"
global soc "jbnssec3_dv jlnssec3_dv jbstat"
global educ "hiqual_dv qfhigh"
global wages "jbhas jboff paygu_dv jbhrs jbot istrtdaty istrtdatm month jbstat jshrs jspayu jbsemp"
global wellbeing_satisf "scghq2_dv sclfsato sf12mcs_dv sf12pcs_dv sclfsat2"

use $base $religion $soc $educ $wages $wellbeing_satisf using "$temp\temp_a_indresp.dta", clear
foreach wave in b c d e f g h i {
	append using "$temp\temp_`wave'_indresp.dta", keep($base $religion $soc $educ $wages $wellbeing_satisf)
}

mdesc

***********************
* Socio-economic status
***********************

* From current job
// Contructed from: https://www.understandingsociety.ac.uk/documentation/mainstage/dataset-documentation/wave/1/datafile/a_indresp/variable/a_jbnssec_dv
clonevar soc3 = jbnssec3_dv
recode soc -9/-8 = .

* From past job (if no current job)
replace soc3 = jlnssec3_dv if soc3 == .
recode soc3 -9/-7 = .

label var soc3 "Socio-economic status"

* Define current soc (including unemployment, inactive and FT student)
* If someone reports the soc but is currently unemployed, he/she is set as unemployed...
* People employed but without reporting SOC will be missing
clonevar socStatus = jbnssec3_dv
recode socStatus (-9/-8=.)
replace socStatus = 4 		if jbstat == 3
replace socStatus = 5 		if inlist(jbstat,4,6,8,97)
replace socStatus = 6		if jbstat == 7

label def socC 1 "Management & professional" 2 "Intermediate" 3 "Routine" 4 ///
 "Unemployed" 5 "Inactive" 6 "FT student"
label val socStatus socC

label var socStatus "Socio-economic status (current)"

* Economic status (11 value is apprenticeship)
gen EconStat=jbstat
recode EconStat (1/2=1) (5=1) (9/11=1) (3=2) (4=3) (6=3)(8=3)(97=3) (7=4) (-9/-1 = .)

lab def econlab 1"In employment" 2"Unemployed" 3"Inactive" 4"FT student"
lab val EconStat econlab

lab var EconStat "Economic status"

*****
* Age
*****

clonevar age = dvage
recode age -9/-1 = .

*********
*Religion
*********

* Belongs to a religion
* Wave 1,4: Asked to all
* Wave 2,3,5,6,7: Asked to new entrants never interviewed and is in the EM boost
// https://www.understandingsociety.ac.uk/documentation/mainstage/dataset-documentation/wave/2/datafile/b_indresp/variable/b_oprlg
gen BelongReligion = (oprlg == 1)
replace BelongReligion = . if oprlg < 0

label var BelongReligion "Belongs to a religion"

* Religion belongs to: England, Scotland, and Wales
// https://www.understandingsociety.ac.uk/documentation/mainstage/dataset-documentation/wave/1/datafile/a_indresp/variable/a_oprlg1
gen Religion = 1 			if oprlg1 >= 2 & oprlg1 <= 11
replace Religion = 2 		if oprlg1 == 12
replace Religion = 3 		if oprlg1 == 13
replace Religion = 4 		if oprlg1 >= 14 & oprlg1 <= 97

label def relig 1 "Christian" 2 "Muslim" 3 "Hindu" 4 "Other"
label val Religion relig

label var Religion "Which religion do you regard yourself as belonging to?"


* wellbeing, life satisfaction, satisfaction with income sf12

gen GQH_bin=1 if scghq2_dv>=3
replace GQH_bin=0 if scghq2_dv>=0 & scghq2_dv<3 // this is the official definition of GHQ caseness

label values GQH_bin GQH_bin
label define GQH_bin  0 "no mental health issues" 1 "with mental health issue" 

//tab sclfsato
clonevar life_sat7c=sclfsato
mvdecode life_sat7c, mv (-10/-1)

ge life_sat3c=.
replace life_sat3c=1 if sclfsato==1 | sclfsato==2
replace life_sat3c=2 if sclfsato==3 | sclfsato==4 | sclfsato==5
replace life_sat3c=3 if sclfsato==6 | sclfsato==7

lab var life_sat3c "Life satisfaction 3 categories"
lab define life_sat3clab 1"Mostly/completely dissatisfied" 2"somewhat satis/disatis + neither" 3"Mostly/completely satisfied"
lab val life_sat3c life_sat3clab

//tab sclfsat2
clonevar income_sat7c=sclfsato
mvdecode income_sat7c, mv (-10/-1)

ge income_sat3c=.
replace income_sat3c=1 if sclfsat2==1 | sclfsat2==2
replace income_sat3c=2 if sclfsat2==3 | sclfsat2==4 | sclfsat2==5
replace income_sat3c=3 if sclfsat2==6 | sclfsat2==7

lab var income_sat3c "Life satisfaction 3 categories"
lab define income_sat3clab 1"Mostly/completely dissatisfied" 2"somewhat satis/disatis + neither" 3"Mostly/completely satisfied"
lab val income_sat3c income_sat3clab

//tab sf12mcs_dv if sf12pcs_dv<0
//tab sf12pcs_dv if sf12pcs_dv<0

mvdecode sf12mcs_dv sf12pcs_dv, mv(-10/-1)

**Cleaning education var- hiqual_dv

gen educ=.
replace educ=1 if hiqual_dv==1 | hiqual_dv==2
replace educ=2 if hiqual_dv==3 
replace educ=3 if hiqual_dv==4 | hiqual_dv==9
replace educ=3 if hiqual_dv==5 & qfhigh==13 
replace educ=3 if hiqual_dv==5 & qfhigh==15
replace educ=2 if hiqual_dv==5 & educ==.
replace educ=4 if educ==.

label values educ educ
label define educ  1 "degree/other higher" 2 "medium/A-level etc" 3 "GCSE/School" 4"missing"
tab educ

keep $base $wages educ BelongReligion Religion soc3 socStatus EconStat age GQH_bin life_sat7c life_sat3c income_sat7c income_sat3c sf12mcs_dv sf12pcs_dv

compress
save "$results/BaseData.dta", replace

********************************************************************************
*Fixed variables - all avaiable in xwavedat.dta (better to use them from xwavedat than from individual files because mistakes have been fixed here
********************************************************************************
use "$dirdata\xwavedat.dta", clear

*Sex
gen female = (sex == 2)
replace female = . 			if sex < 1
label var female "Female"

* Gender
clonevar gender = sex
recode gender -9/-1=.

* Ethnicity 
clonevar Race_dv = racel_dv
recode Race_dv -9 = .


recode Race_dv (1/4=1) (5/8=2) (9=3) (10=4) (11=5) (12=6) (13=7) (14=8) (15=9) (16=10) (17=11) (97=12), gen(EthnLong)

label def race 1 "White" 2 "White Mixed" 3 "Indian" 4 "Pakistani" 5 "Bangladeshi" ///
6 "Chinese" 7 "Asian other" 8 "Black Caribbean" 9 "African" 10 "Black other" ///
11 "Arab" 12 "Other"

label val EthnLong race
label var EthnLong "Ethnicity 12 groups"

* Ethnicity 4 groups
gen Ethnicity4 = 1 			if inlist(EthnLong,1,2)
replace Ethnicity4 = 2 		if inlist(EthnLong,3,4,5,6,7)
replace Ethnicity4 = 3 		if inlist(EthnLong,8,9,10)
replace Ethnicity4 = 4 		if inlist(EthnLong,11,12)

label def race4 1 "White/White Mixed" 2 "Asian" 3 "Black" 4 "Other"

label val Ethnicity4 race4
label var Ethnicity4 "Ethnicity 4 groups"

* Ethnicity boost groups
gen EthnicityB = 2 if inlist(EthnLong,3)
replace EthnicityB = 3 	if inlist(EthnLong,4)
replace EthnicityB = 4 	if inlist(EthnLong,5)
replace EthnicityB = 5 	if inlist(EthnLong,8)
replace EthnicityB = 6 	if inlist(EthnLong,9)
*replace EthnicityBoost = 1 	if inlist(EthnLong,1)

label def raceboost 1 "White" 2 "Indian" 3 "Pakistani" 4 "Bangladeshi" 5 "Caribbean" 6 "African"

label val EthnicityB raceboost
label var EthnicityB "Ethnicity boost groups"

* Ethnicity boost groups (including white)
clonevar EthnicityBW = EthnicityB
replace EthnicityBW = 1 	if inlist(EthnLong,1)

label val EthnicityBW raceboost
label var EthnicityBW "Ethnicity boost groups (includes whites)"


* Born in UK?
gen UKBorn = (bornuk_dv == 1)
replace UKBorn = . 			if bornuk_dv < 0

label var UKBorn "Born in UK"

* Year arrived in UK
gen YearArrivalUK = yr2uk4
replace YearArrivalUK = . if YearArrivalUK == -9

*First vs. second generation
* First generation: Born outside the UK
* Second generation: Born in the UK but both parents were born outside the UK
* Many missing
gen MigrantGen = 1 			if bornuk_dv == 2
replace MigrantGen = 2 		if (bornuk_dv == 1) & (pacob>=5 & macob>=5)

label def miggen 1 "First Generation" 2 "Second Generation"
label val MigrantGen miggen

label var MigrantGen "Migrant generation"

keep pidp hhorig memorig psu strata female gender Race_dv  EthnLong Ethnicity4 EthnicityB EthnicityBW UKBorn YearArrivalUK MigrantGen

compress
save "$results/FixedVars.dta", replace


*********
*Weights
*********
/*
* Wave 1: 
des indinus_xw // cross-section (combines GPS and EMBS) (no BHPS sample in wave 1)

* Wave 2:
des indinub_xw // cross-section (combines GPS, EMBS, and BHPS)
des indinus_lw // longitudinal (combines GPS and EMBS) (remember no BHPS sample in wave 1)

* From Wave 3 onwards:
des indinub_xw // cross-section (combines GPS, EMBS, and BHPS)
des indinub_lw // longitudinal (combines GPS, EMBS, and BHPS)
des indinus_lw // longitudinal (combines GPS and EMBS)
*/


* Create dataset of weights
global weight1 "indinus_xw"
global weight2 "indinub_xw indinus_lw"
global weight3 "indinub_xw indinub_lw indinus_lw"
global weight4 "indinub_xw indinub_lw indinus_lw indinui_xw"


use wave pidp $weight1 using "$temp\temp_a_indresp.dta", clear
tempfile weight_a
save "`weight_a'"

use wave pidp $weight2 using "$temp\temp_b_indresp.dta", clear
tempfile weight_b
save "`weight_b'"

foreach wave in c d e{
	use wave pidp $weight3 using "$temp\temp_`wave'_indresp.dta", clear
	tempfile weight_`wave'
	save "`weight_`wave''"
}

foreach wave in f g h i {
	use wave pidp $weight4 using "$temp\temp_`wave'_indresp.dta", clear
	tempfile weight_`wave'
	save "`weight_`wave''"
}

use `weight_a', clear
	foreach wave in b c d e f g h i{
	append using `weight_`wave''
}

* Create new x-section weight that combines indinus_xw in w1 with indinub_xw waves 2-5 with indinui_xw waves 6-9
gen weight_xw = indinus_xw 			if wave == 1
replace weight_xw = indinub_xw 		if wave > 1 & wave <= 5
replace weight_xw = indinui_xw 		if wave > 5 & wave <= 9


save "$results/weights.dta", replace

******************************
******************************
********* LOCAL AREA *********
******************************
******************************

*** WAVE 3

use "...c_hhresp.dta", replace
merge 1:m c_hidp using "...c_indresp.dta"
drop _merge

// neighbourhood cohesion scale

clonevar neisco_wave3 = c_nbrcoh_dv

//neighbourhood

recode c_nbrcoh1 (-9=-1) (-8=-3) (-7=-4) (-1=-1) (-2=-2) (1=1) (2=2) (3=3) (4=4) (5=5), gen(closeknitneighbourhod_wave3)
label define closeknitneighbourhod_wave3 -10 "Not available for IEMB" -4 "proxy completion"   -3 "not applicable" -2 "refusal" -1 "Not Applicable" 1 "strongly agree" 2 "agree" 3 "neither agree not disagree" 4 "disagree" 5 "strongly disagree", modify
label var closeknitneighbourhod_wave3 "this is a close-knit neighbourhood?"
label values closeknitneighbourhod_wave3 closeknitneighbourhod_wave3

//helping neighbours

recode c_nbrcoh2 (-9=-1) (-8=-3) (-7=-4) (-1=-1) (-2=-2) (1=1) (2=2) (3=3) (4=4) (5=5), gen(willingtohelpneighbours_wave3)
label define willingtohelpneighbours_wave3 -10 "Not available for IEMB" -4 "proxy completion"   -3 "not applicable" -2 "refusal" -1 "Not Applicable" 1 "strongly agree" 2 "agree" 3 "neither agree not disagree" 4 "disagree" 5 "strongly disagree", modify
label var willingtohelpneighbours_wave3 "people around here are willing to help their neighbours?"
label values willingtohelpneighbours_wave3 willingtohelpneighbours_wave3

//neighbourhood trust

recode c_nbrcoh3 (-9=-1) (-8=-3) (-7=-4) (-1=-1) (-2=-2) (1=1) (2=2) (3=3) (4=4) (5=5), gen(neighbourhoodtrust_wave3)
label define neighbourhoodtrust_wave3 -10 "Not available for IEMB" -4 "proxy completion"   -3 "not applicable" -2 "refusal" -1 "Not Applicable" 1 "strongly agree" 2 "agree" 3 "neither agree not disagree" 4 "disagree" 5 "strongly disagree", modify 
label var neighbourhoodtrust_wave3 "People in this neighbourhood can be trusted?"
label values neighbourhoodtrust_wave3 neighbourhoodtrust_wave3

//neighbourhood ties

recode c_nbrcoh4 (-9=-1) (-8=-3) (-7=-4) (-1=-1) (-2=-2) (1=1) (2=2) (3=3) (4=4) (5=5), gen(neighbourhoodties_wave3)
label define neighbourhoodties_wave3 -10 "Not available for IEMB" -4 "proxy completion"   -3 "not applicable" -2 "refusal" -1 "Not Applicable" 1 "strongly agree" 2 "agree" 3 "neither agree not disagree" 4 "disagree" 5 "strongly disagree", modify 
label var neighbourhoodties_wave3 "People in this neighbourhood generally don't get along with each other"
label values neighbourhoodties_wave3 neighbourhoodties_wave3

//extent of racial attacks

recode c_crrace (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(raceattacka_wave3)
label define raceattacka_wave3 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var raceattacka_wave3 "How common in your area are insults or attacks to do with someone's race or colour?" 
label values raceattacka_wave3 raceattacka_wave3 

//crime - break ins

recode c_crburg (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(crimebreakina_wave3)
label define crimebreakina_wave3 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var crimebreakina_wave3 "How common in your area are homes broken into?"
label values crimebreakina_wave3 crimebreakina_wave3 

//crime - car stolen

recode c_crcar (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(crimecarestolena_wave3) 
label define crimecarestolena_wave3 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var crimecarestolena_wave3 "How common in your area are cars broken into or stolen?"
label values crimecarestolena_wave3 crimecarestolena_wave3   

//crime - street attacks

recode c_crmugg (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(crimestreetattacksa_wave3) 
label define crimestreetattacksa_wave3 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var crimestreetattacksa_wave3 "How common in your area are people attacked on the streets?" 
label values crimestreetattacksa_wave3 crimestreetattacksa_wave3 

//Area Safety - teenagers hanging around

recode c_crteen (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaSafteyTeena_wave3) 
label define AreaSafteyTeena_wave3 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaSafteyTeena_wave3 "How common in your area are teenagers hanging around in the streets?"
label values AreaSafteyTeena_wave3 AreaSafteyTeena_wave3

 
//Area Perception - Rubbish

recode c_crrubsh (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionRubbisha_wave3)
label define AreaPerceptionRubbisha_wave3 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaPerceptionRubbisha_wave3 "How common in your area is rubbish or litter lying around?"
label values AreaPerceptionRubbisha_wave3 AreaPerceptionRubbisha_wave3    

//Area Perception - Graffiti

recode c_crgraf (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionGraffitia_wave3)
label define AreaPerceptionGraffitia_wave3 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaPerceptionGraffitia_wave3 "How common in your area is there graffiti on walls or on buildings?"
label values AreaPerceptionGraffitia_wave3 AreaPerceptionGraffitia_wave3 

//Area perception - drunks

recode c_crdrnk (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionDrunksa_wave3)
label define AreaPerceptionDrunksa_wave3 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaPerceptionDrunksa_wave3 "How common in your area are drunks or tramps on the streets?"
label values AreaPerceptionDrunksa_wave3 AreaPerceptionDrunksa_wave3  

//Area perception - vandalism

recode c_crvand (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionVandala_wave3)
label define AreaPerceptionVandala_wave3 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var AreaPerceptionVandala_wave3 "How common in your area is vandalism and deliberate damage to property?"
label values AreaPerceptionVandala_wave3 AreaPerceptionVandala_wave3 

//neighbourhood - belonging

recode c_scopngbha (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2)(3=3) (4=4) (5=5), gen(BelongingLocal_wave3)
label define BelongingLocal_wave3 -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify
label var BelongingLocal_wave3 "I feel like I belonging to this neighbourhood?"
label values BelongingLocal_wave3 BelongingLocal_wave3

//friendship - local

recode c_scopngbhb (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2)(3=3) (4=4) (5=5), gen(FriendshipLocal_wave3)
label define FriendshipLocal_wave3 -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify
label var FriendshipLocal_wave3 "The friendships and associations I have with other people in my neighbourhood mean a lot to me?"
label values FriendshipLocal_wave3 FriendshipLocal_wave3
 

//Neighbourhood - borrowing

recode c_scopngbhc (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2)(3=3) (4=4) (5=5), gen(AdviceLocal_wave3)
label define AdviceLocal_wave3 -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify 
label var AdviceLocal_wave3 "If I needed advice about something I could go to someone in my neighbourhood?"
label values AdviceLocal_wave3 AdviceLocal_wave3 

//neighbourhood - borrow and lend

recode c_scopngbhd (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2)(3=3) (4=4) (5=5), gen(BorrowLocal_wave3)
label define BorrowLocal_wave3 -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify 
label var BorrowLocal_wave3 "I borrow things and exchange favours with my neighbours"
label values BorrowLocal_wave3 BorrowLocal_wave3 

//Victim of crime

recode c_crwora (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2), gen(VictimCrime_wave3)
label define VictimCrime_wave3 -2 "refusal" -1 "Not Applicable" 1 "Yes" 2 "No", modify
label var VictimCrime_wave3 "Do you ever worry about the possibility that you, or anyone else who lives with you, might be the victim of crime?"
label values VictimCrime_wave3 VictimCrime_wave3 

//worry about crime

recode c_crworb (-9=-1) (-8=4) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3), gen(WorryCrime_wave3)
label define WorryCrime_wave3 -2 "refusal" -1 "Not Applicable" 1 "big worry" 2 "bit of a worry" 3 "occasional doubt" 4 "not applicable no fear of crime", modify
label var WorryCrime_wave3 "Is this a big worry, a bit of a worry, or an occasional doubt?"
label values WorryCrime_wave3 WorryCrime_wave3 

//worry about walking after dark

recode c_crdark (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4) (5=5), gen(DarkSafety_Wave3)
label define DarkSafety_Wave3 -2 "refusal" -1 "Not Applicable" 1 "very safe" 2 "fairly safe" 3 "a bit unsafe" 4 "very unsafe" 5 "spontaneous: never goes out after dark", modify 
label var DarkSafety_Wave3 "How safe do you feel walking alone in this area after dark?"
label values DarkSafety_Wave3 DarkSafety_Wave3 

//proportion of friends living in the local area

recode c_simarea (-9=-1) (-8=5) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(PropFriendsArea_Wave3)
label define PropFriendsArea_Wave3 -2 "refusal" -1 "Not Applicable" 1 "all are in the local area" 2 "more than half" 3 "about half" 4 "or less than half" 5 "no applicable because friends", modify
label var PropFriendsArea_Wave3 "What proportion of your friends live in your local area?"
label values PropFriendsArea_Wave3 PropFriendsArea_Wave3  

//proportion of friends of the same ethnicity

recode c_simrace (-9=-1) (-8=5) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(PropEthnFriend_Wave3)
label define PropEthnFriend_Wave3 -2 "refusal" -1 "Not Applicable" 1 "all the same" 2 "more than half" 3 "about half" 4 "or less than half" 5 "no friends not applicable", modify
label var PropEthnFriend_Wave3 " What proportion of your friends are of the same ethnic group as you?"
label values PropEthnFriend_Wave3 PropEthnFriend_Wave3   

//Harrassment - attacked

recode c_attacked_dv (-9/-7=-1) (-2=-2) (-1=-1) (0=0) (1=1), gen(attacked_dv_wave3)
label define attacked_dv_wave3 -9 "Missing" -2 "Refusal" -1 "Not Applicable" 0 "No" 1 "Yes", modify
label var attacked_dv_wave3 "In the last 12 months, have you been physically attacked in any of these places?"
label values attacked_dv_wave3 attacked_dv_wave3 

//Harrassment - avoided dv

recode c_avoided_dv (-9/-7=-1) (-2=-2) (-1=-1) (0=0) (1=1), gen(avoided_dv_wave3)
label define avoided_dv_wave3 -9 "Missing" -2 "Refusal" -1 "Not Applicable" 0 "No" 1 "Yes", modify
label var avoided_dv_wave3 "In the last 12 months, have you avoided some place?"
label values avoided_dv_wave3 avoided_dv_wave3 

//Harrassment - insulted dv

recode c_insulted_dv (-9/-7=-1) (-2=-2) (-1=-1) (0=0) (1=1), gen(insulted_dv_wave3)
label define insulted_dv_wave3 -9 "Missing" -2 "Refusal" -1 "Not Applicable" 0 "No" 1 "Yes", modify
label var insulted_dv_wave3 "in the last 12 months, have you been insulted in some place?"
label values insulted_dv_wave3 insulted_dv_wave3 

//Harrassment - unsafe dv

recode c_unsafe_dv (-9/-7=-1) (-2=-2) (-1=-1) (0=0) (1=1), gen(unsafe_dv_wave3)
label define unsafe_dv_wave3 -9 "Missing" -2 "Refusal" -1 "Not Applicable" 0 "No" 1 "Yes", modify
label var unsafe_dv_wave3 "In the last 12 months, have you felt unsafe in some place?"
label values unsafe_dv_wave3 unsafe_dv_wave3 

//Harrassment - unsafe places

recode c_unsafeo_code (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (96=-1) (4/10=4) (12/18=4) (11=5) (97=6), gen(UnsafePlace_Wave3)  
label define UnsafePlace_Wave3 -9 "Missing" -2 "Refusal" -1 "Not Applicable" 1 "At school" 2 "at college or university" 3 "at work" 4 "in a public place" 5 "at home" 6 "in another place", modify  
label var UnsafePlace_Wave3 "In the last 12 months where have you felt unsafe?"
label values UnsafePlace_Wave3 UnsafePlace_Wave3   

//Harrasment - avoiding places

recode c_avoidanceo_code (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (96=-1) (4/10=4) (12/18=4) (11=5) (97=6), gen(AvoidPlace_Wave3)
label define AvoidPlace_Wave3 -9 "Missing" -2 "Refusal" -1 "Not Applicable" 1 "At school" 2 "at college or university" 3 "at work" 4 "in a public place" 5 "at home" 6 "in another place", modify
label var AvoidPlace_Wave3 "In the last 12 months, did you avoid for any of these reasons? If so, which ones?"
label values AvoidPlace_Wave3 AvoidPlace_Wave3 

//Harrassment - insulted in places    

recode c_insultedo_code (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (96=-1) (4/10=4) (12/18=4) (11=5) (97=6), gen(InsultedPlace_Wave3)
label define InsultedPlace_Wave3 -9 "Missing" -2 "Refusal" -1 "Not Applicable" 1 "At school" 2 "at college or university" 3 "at work" 4 "in a public place" 5 "at home" 6 "in another place", modify
label var InsultedPlace_Wave3 "In the last 12 months, have you been insulted, called names, threatened or shouted at, in any of these places? If so, which ones?"
label values InsultedPlace_Wave3 InsultedPlace_Wave3  

//Harrassment - attacked in places

recode c_attackedo_code (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (96=-1) (4/10=4) (12/18=4) (11=5) (97=6), gen(AttackedPlace_Wave3)
label define AttackedPlace_Wave3 -9 "Missing" -2 "Refusal" -1 "Not Applicable" 1 "At school" 2 "at college or university" 3 "at work" 4 "in a public place" 5 "at home" 6 "in another place", modify
label var AttackedPlace_Wave3 "In the last 12 months, have you been physically attacked in any of these places? If so, which ones?"
label values AttackedPlace_Wave3 AttackedPlace_Wave3  

//Housing tenure

recode c_tenure_dv (-9/-8=-1) (-1=-1) (-2=-2) (1/2=1) (3/4=2) (5/7=3) (8=-1), gen(HousingTenure_Wave3)
label define HousingTenure_Wave3 -2 "refusal" -1 "not applicable" 1 "Owner Occupied" 2 "Social renting" 3 "Private Renting", modify
label var HousingTenure_Wave3 "Housing tenure" 
label values HousingTenure_Wave3 HousingTenure_Wave3  

//housing benefit

recode c_renthb (-9=-9) (-8=-1) (-1=-1) (-2=-2) (1=1) (2=2), gen(HousingBenefit_Wave3)
label define HousingBenefit_Wave3 -2 "refusal" -1 "not applicable" 1 "yes" 2 "no", modify
label var HousingBenefit_Wave3 "housing benefit?"
label values HousingBenefit_Wave3 HousingBenefit_Wave3

//Housing tenure since previous wave

recode c_ff_hsownd (-9/-8=-1) (-1=-1) (-2=-2) (1/2=1) (3/4=2) (5/7=3) (8=-1), gen(HousingTenurePrevWave_Wave3)
label define HousingTenurePrevWave_Wave3 -2 "refusal" -1 "not applicable" 1 "Owner Occupied" 2 "Social renting" 3 "Private Renting", modify
label var HousingTenurePrevWave_Wave3 "Housing tenure since last wave" 
label values HousingTenurePrevWave_Wave3 HousingTenurePrevWave_Wave3

// urban or rural area - derived

recode c_urban_dv (-9=-9) (-8=-1) (-1=-1) (-2=-2) (1=1) (2=2), gen(UrbanRural_Wave3)
label define UrbanRural_Wave3 -2 "refusal" -1 "not applicable" 1 "urban" 2 "rural", modify
label var UrbanRural_Wave3 "urban or rural area?"
label values UrbanRural_Wave3 UrbanRural_Wave3

//variables to keep

keep c_hidp c_pno c_intnum pidp closeknitneighbourhod_wave3 willingtohelpneighbours_wave3 neighbourhoodtrust_wave3 neighbourhoodties_wave3 raceattacka_wave3 crimebreakina_wave3 crimecarestolena_wave3 crimestreetattacksa_wave3 AreaSafteyTeena_wave3 AreaPerceptionRubbisha_wave3 AreaPerceptionGraffitia_wave3 AreaPerceptionDrunksa_wave3 AreaPerceptionVandala_wave3 BelongingLocal_wave3 FriendshipLocal_wave3 AdviceLocal_wave3 BorrowLocal_wave3 VictimCrime_wave3 WorryCrime_wave3 DarkSafety_Wave3 PropFriendsArea_Wave3 PropEthnFriend_Wave3 attacked_dv_wave3 avoided_dv_wave3 insulted_dv_wave3 unsafe_dv_wave3 UnsafePlace_Wave3 AvoidPlace_Wave3 InsultedPlace_Wave3 AttackedPlace_Wave3 HousingTenure_Wave3 HousingBenefit_Wave3 HousingTenurePrevWave_Wave3 UrbanRural_Wave3 neisco_wave3

renvars neisco_wave3 PropFriendsArea_Wave3 PropEthnFriend_Wave3 UnsafePlace_Wave3 AvoidPlace_Wave3 InsultedPlace_Wave3 AttackedPlace_Wave3 HousingTenure_Wave3 HousingBenefit_Wave3 HousingTenurePrevWave_Wave3 UrbanRural_Wave3 , postsub(_Wave3 _wave3)
renvars neisco_wave3- UrbanRural_wave3, postsub(_wave3 _wave)
gen wave = 3

drop c_hidp c_intnum c_pno

save "...temp\temp_local_w3.dta", replace

*** WAVE 6

use "...f_hhresp.dta", replace
merge 1:m f_hidp using "...f_indresp.dta"
drop _merge

//Wave 6 recoding  matched variables 

// neighbourhood cohesion scale

clonevar neisco_wave6 = f_nbrcoh_dv

//neighbourhood

recode f_nbrcoh1 (-9=-1) (-8=-3) (-7=-4) (-1=-1) (-2=-2) (1=1) (2=2) (3=3) (4=4) (5=5), gen(closeknitneighbourhod_wave6)
label define closeknitneighbourhod_wave6 -10 "Not available for IEMB" -4 "proxy completion"   -3 "not applicable" -2 "refusal" -1 "Not Applicable" 1 "strongly agree" 2 "agree" 3 "neither agree not disagree" 4 "disagree" 5 "strongly disagree", modify
label var closeknitneighbourhod_wave6 "this is a close-knit neighbourhood?"
label values closeknitneighbourhod_wave6 closeknitneighbourhod_wave6

//helping neighbours

recode f_nbrcoh2 (-9=-1) (-8=-3) (-7=-4) (-1=-1) (-2=-2) (1=1) (2=2) (3=3) (4=4) (5=5), gen(willingtohelpneighbours_wave6)
label define willingtohelpneighbours_wave6 -10 "Not available for IEMB" -4 "proxy completion"   -3 "not applicable" -2 "refusal" -1 "Not Applicable" 1 "strongly agree" 2 "agree" 3 "neither agree not disagree" 4 "disagree" 5 "strongly disagree", modify
label var willingtohelpneighbours_wave6 "people around here are willing to help their neighbours?"
label values willingtohelpneighbours_wave6 willingtohelpneighbours_wave6

//neighbourhood trust

recode f_nbrcoh3 (-9=-1) (-8=-3) (-7=-4) (-1=-1) (-2=-2) (1=1) (2=2) (3=3) (4=4) (5=5), gen(neighbourhoodtrust_wave6)
label define neighbourhoodtrust_wave6 -10 "Not available for IEMB" -4 "proxy completion"   -3 "not applicable" -2 "refusal" -1 "Not Applicable" 1 "strongly agree" 2 "agree" 3 "neither agree not disagree" 4 "disagree" 5 "strongly disagree", modify 
label var neighbourhoodtrust_wave6 "People in this neighbourhood can be trusted?"
label values neighbourhoodtrust_wave6 neighbourhoodtrust_wave6

//neighbourhood ties

recode f_nbrcoh4 (-9=-1) (-8=-3) (-7=-4) (-1=-1) (-2=-2) (1=1) (2=2) (3=3) (4=4) (5=5), gen(neighbourhoodties_wave6)
label define neighbourhoodties_wave6 -10 "Not available for IEMB" -4 "proxy completion"   -3 "not applicable" -2 "refusal" -1 "Not Applicable" 1 "strongly agree" 2 "agree" 3 "neither agree not disagree" 4 "disagree" 5 "strongly disagree", modify 
label var neighbourhoodties_wave6 "People in this neighbourhood generally don't get along with each other"
label values neighbourhoodties_wave6 neighbourhoodties_wave6

recode f_crwora (-11=-11) (-10=-10)(-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2), gen(VictimCrime_wave6)
label define VictimCrime_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1"Yes" 2"No", modify
label var VictimCrime_wave6 "Do you ever worry about the possibility that you, or anyone else who lives with you, might be the victim of crime?"
label values VictimCrime_wave6 VictimCrime_wave6 

//worry about crime

recode f_crworb (-11=-11) (-10=-10) (-9=1) (-8=4) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3), gen(WorryCrime_wave6)
label define WorryCrime_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "big worry" 2 "bit of a worry" 3 "occasional doubt" 4 "not applicable no fear of crime", modify
label var WorryCrime_wave6 "is this a big worry, a bit of a worry, or an occasional doubt?"
label values WorryCrime_wave6 WorryCrime_wave6 

//worry about walking after dark

recode f_crdark (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4) (5=5), gen(DarkSafety_Wave6)
label define DarkSafety_Wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "very safe" 2 "fairly safe" 3 "a bit unsafe" 4 "very unsafe" 5 "spontaneous: never goes out after dark", modify 
label var DarkSafety_Wave6 "How safe do you feel walking alone in this area after dark?"
label values DarkSafety_Wave6 DarkSafety_Wave6

//proportion of friends living in the local area

recode f_simarea (-11=-11) (-10=-10) (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4) (5=5), gen(PropFriendsArea_Wave6)
label define PropFriendsArea_Wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "All are in the local area" 2 "more than half" 3 "about half" 4 "or less than half" 5 "don’t have any friends" 6 "not applicable as no friends", modify
label var PropFriendsArea_Wave6 "What proportion of your friends live in your local area?"
label values PropFriendsArea_Wave6 PropFriendsArea_Wave6 

//proportion of friends of the same ethnicity

recode f_simrace (-11=-11) (-10=-10) (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4) (5=5), gen(PropEthnFriend_Wave6)
label define PropEthnFriend_Wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "all the same" 2 "more than half" 3 "about half" 4 "or less than half" 5 "or less than half" 5 "don’t have any friends" 6 "no friends not applicable", modify
label var PropEthnFriend_Wave6 "What proportion of your friends are of the same ethnic group as you?"
label values PropEthnFriend_Wave6 PropEthnFriend_Wave6  

//neighbourhood - belonging

recode f_scopngbha (-11=-11) (-10=-10) (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2)(3=3) (4=4) (5=5), gen(BelongingLocal_wave6)
label define BelongingLocal_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify
label var BelongingLocal_wave6 "I feel like I belonging to this neighbourhood?"
label values BelongingLocal_wave6 BelongingLocal_wave6

//friendship - local

recode f_scopngbhb (-11=-11) (-10=-10) (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2)(3=3) (4=4) (5=5), gen(FriendshipLocal_wave6)
label define FriendshipLocal_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify
label var FriendshipLocal_wave6 "The friendships and associations I have with other people in my neighbourhood mean a lot to me?"
label values FriendshipLocal_wave6 FriendshipLocal_wave6

//Neighbourhood - borrowing

recode f_scopngbhc (-11=-11) (-10=-10) (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2)(3=3) (4=4) (5=5), gen(AdviceLocal_wave6)
label define AdviceLocal_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify 
label var AdviceLocal_wave6 "If I needed advice about something I could go to someone in my neighbourhood?"
label values AdviceLocal_wave6 AdviceLocal_wave6 

//neighbourhood - borrow and lend

recode f_scopngbhd (-11=-11) (-10=-10) (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2)(3=3) (4=4) (5=5), gen(BorrowLocal_wave6)
label define BorrowLocal_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify 
label var BorrowLocal_wave6 "I borrow things and exchange favours with my neighbours"
label values BorrowLocal_wave6 BorrowLocal_wave6

//Neighbour similarities

recode f_scopngbhg (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2)(3=3) (4=4)(5=5), gen(NeighbourSim_wave6)
label define NeighbourSim_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree", modify
label var NeighbourSim_wave6 "Am similar to others in neighbourhood?"
label values NeighbourSim_wave6 NeighbourSim_wave6 

//Talk to neighbours     

recode f_scopngbhh (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2)(3=3) (4=4) (5=5), gen(NeighbourTalk_wave6)
label define NeighbourTalk_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree", modify
label var NeighbourTalk_wave6 "talk regularly to neighbours?" 
label values NeighbourTalk_wave6 NeighbourTalk_wave6  


//extent of racial attacks

recode f_crrace (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(raceattack_wave6)
label define raceattack_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var raceattack_wave6 "How common in your area are insults or attacks to do with someone's race or colour?"
label values raceattack_wave6 raceattack_wave6  

//crime - break ins

recode f_crburg (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(crimebreakin_wave6)
label define crimebreakin_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var crimebreakin_wave6 "How common in your area are homes broken into?"
label values crimebreakin_wave6 crimebreakin_wave6 

//crime - car stolen

recode f_crcar (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(crimecarestolen_wave6) 
label define crimecarestolen_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var crimecarestolen_wave6 "How common in your area are cars broken into or stolen?"
label values crimecarestolen_wave6 crimecarestolen_wave6  

//crime - street attacks

recode f_crmugg (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(crimestreetattacks_wave6) 
label define crimestreetattacks_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var crimestreetattacks_wave6 "How common in your area are people attacked on the streets?"
label values crimestreetattacks_wave6 crimestreetattacks_wave6 

//Area Safety - teenagers hanging around

recode f_crteen (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaSafteyTeen_wave6) 
label define AreaSafteyTeen_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaSafteyTeen_wave6 "How common in your area are teenagers hanging around in the streets?"
label values AreaSafteyTeen_wave6 AreaSafteyTeen_wave6 

//Area Perception - Rubbish

recode f_crrubsh (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionRubbish_wave6)
label define AreaPerceptionRubbish_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaPerceptionRubbish_wave6 "How common in your area is rubbish or litter lying around?"
label values AreaPerceptionRubbish_wave6 AreaPerceptionRubbish_wave6   

//Area Perception - Graffiti

recode f_crgraf (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionGraffiti_wave6)
label define AreaPerceptionGraffiti_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaPerceptionGraffiti_wave6 "How common in your area is there graffiti on walls or on buildings?"
label values AreaPerceptionGraffiti_wave6 AreaPerceptionGraffiti_wave6

//Area perception - drunks

recode f_crdrnk (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionDrunks_wave6)
label define AreaPerceptionDrunks_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaPerceptionDrunks_wave6 "How common in your area are drunks or tramps on the streets?"
label values AreaPerceptionDrunks_wave6 AreaPerceptionDrunks_wave6  

//Area perception - vandalism

recode f_crvand (-11=-11) (-10=-10) (-9/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionVandal_wave6)
label define AreaPerceptionVandal_wave6 -11 "Only available for IEMB" -10 "Not Available for IEMB" -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var AreaPerceptionVandal_wave6 "How common in your area is vandalism and deliberate damage to property?"
label values AreaPerceptionVandal_wave6

//Housing tenure

recode f_tenure_dv (-9/-8=-1) (-1=-1) (-2=-2) (1/2=1) (3/4=2) (5/7=3) (8=-1), gen(HousingTenure_Wave6)
label define HousingTenure_Wave6 -2 "refusal" -1 "not applicable" 1 "Owner Occupied" 2 "Social renting" 3 "Private Renting", modify
label var HousingTenure_Wave6 "Housing tenure" 
label values HousingTenure_Wave6 HousingTenure_Wave6 

//housing benefit

recode f_renthb (-9=-9) (-8=-1) (-1=-1) (-2=-2) (1=1) (2=2), gen(HousingBenefit_Wave6)
label define HousingBenefit_Wave6 -2 "refusal" -1 "not applicable" 1 "yes" 2 "no", modify
label var HousingBenefit_Wave6 "housing benefit?"
label values HousingBenefit_Wave6 HousingBenefit_Wave6

//Housing tenure since previous wave

recode f_ff_hsownd (-9/-8=-1) (-1=-1) (-2=-2) (1/2=1) (3/4=2) (5/7=3) (8=-1), gen(HousingTenurePrevWave_Wave6)
label define HousingTenurePrevWave_Wave6 -2 "refusal" -1 "not applicable" 1 "Owner Occupied" 2 "Social renting" 3 "Private Renting", modify
label var HousingTenurePrevWave_Wave6 "Housing tenure since last wave" 
label values HousingTenurePrevWave_Wave6 HousingTenurePrevWave_Wave6

// urban or rural area - derived

recode f_urban_dv (-9=-9) (-8=-1) (-1=-1) (-2=-2) (1=1) (2=2), gen(UrbanRural_Wave6)
label define UrbanRural_Wave6 -2 "refusal" -1 "not applicable" 1 "urban" 2 "rural", modify
label var UrbanRural_Wave6 "urban or rural area?"
label values UrbanRural_Wave6 UrbanRural_Wave6

//variables to keep 

keep f_hidp f_pno f_intnum pidp raceattack_wave6 VictimCrime_wave6 WorryCrime_wave6 DarkSafety_Wave6 PropFriendsArea_Wave6 PropEthnFriend_Wave6 BelongingLocal_wave6 FriendshipLocal_wave6 AdviceLocal_wave6 BorrowLocal_wave6 NeighbourSim_wave6 NeighbourTalk_wave6 raceattack_wave6 crimebreakin_wave6 crimecarestolen_wave6 crimestreetattacks_wave6 AreaSafteyTeen_wave6 AreaPerceptionRubbish_wave6 AreaPerceptionGraffiti_wave6 AreaPerceptionDrunks_wave6 AreaPerceptionVandal_wave6 HousingTenure_Wave6 HousingBenefit_Wave6 HousingTenurePrevWave_Wave6 UrbanRural_Wave6 closeknitneighbourhod_wave6 neighbourhoodties_wave6 neighbourhoodtrust_wave6 willingtohelpneighbours_wave6 neisco_wave6

renvars DarkSafety_Wave6 PropFriendsArea_Wave6 PropEthnFriend_Wave6 HousingTenure_Wave6 HousingBenefit_Wave6 HousingTenurePrevWave_Wave6 UrbanRural_Wave6 , postsub(_Wave6 _wave6)

renvars neisco_wave6- UrbanRural_wave6, postsub(_wave6 _wave)
rename raceattack_wave raceattacka_wave
gen wave = 6

drop f_hidp f_intnum f_pno

save "...temp\temp_local_w6.dta", replace

*** WAVE 9 

use "...i_hhresp.dta", replace
merge 1:m i_hidp using "...i_indresp.dta"
drop _merge

//Wave 9 recoding  matched variables 

//proportion of friends living in the local area

recode i_simarea (-9=-1) (-8=5) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(PropFriendsArea_Wave9)
label define PropFriendsArea_Wave9 -2 "refusal" -1 "Not Applicable" 1 "all the same" 2 "more than half" 3 "about half" 4 "or less than half" 5 "no friends not applicable", modify
label var PropFriendsArea_Wave9 "What proportion of your friends live in your local area?"
label values PropFriendsArea_Wave9 PropFriendsArea_Wave9 

//proportion of friends of the same ethnicity

recode i_simrace (-9=-1) (-8=5) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(PropEthnFriend_Wave9)
label define PropEthnFriend_Wave9 -2 "refusal" -1 "Not Applicable" 1 "all the same" 2 "more than half" 3 "about half" 4 "or less than half" 5 "no friends not applicable", modify
label var PropEthnFriend_Wave9 "What proportion of your friends are of the same ethnic group as you?"
label values PropEthnFriend_Wave9 PropEthnFriend_Wave9 

//neighbourhood - belonging

recode i_scopngbha (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4) (5=5), gen(BelongingLocal_wave9)
label define BelongingLocal_wave9 -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify
label var BelongingLocal_wave9 "I feel like I belonging to this neighbourhood?"
label values BelongingLocal_wave9 BelongingLocal_wave9 

//friendship - local

recode i_scopngbhb (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4) (5=5), gen(FriendshipLocal_wave9)
label define FriendshipLocal_wave9 -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify
label var FriendshipLocal_wave9 "The friendships and associations I have with other people in my neighbourhood mean a lot to me?"
label values FriendshipLocal_wave9 FriendshipLocal_wave9

//Neighbourhood - borrowing

recode i_scopngbhc (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4) (5=5), gen(AdviceLocal_wave9)
label define AdviceLocal_wave9 -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify 
label var AdviceLocal_wave9 "If I needed advice about something I could go to someone in my neighbourhood?"
label values AdviceLocal_wave9 AdviceLocal_wave9 

//neighbourhood - borrow and lend

recode i_scopngbhd (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4) (5=5), gen(BorrowLocal_wave9)
label define BorrowLocal_wave9 -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify 
label var BorrowLocal_wave9 "I borrow things and exchange favours with my neighbours"
label values BorrowLocal_wave9 BorrowLocal_wave9

//Neighbour similarities

recode i_scopngbhg (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4) (5=5), gen(NeighbourSim_wave9)
label define NeighbourSim_wave9 -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify
label var NeighbourSim_wave9 "Am similar to others in neighbourhood?"
label values NeighbourSim_wave9 NeighbourSim_wave9 

//Talk to neighbours     

recode i_scopngbhh (-9=-1) (-8=6) (-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4) (5=5), gen(NeighbourTalk_wave9)
label define NeighbourTalk_wave9 -2 "refusal" -1 "Not Applicable" 1 "Strongly agree" 2 "agree" 3 "neither agree nor disagree disagree" 4 "disagree" 5 "strongly disagree" 6 "face to face self completion", modify
label var NeighbourTalk_wave9 "talk regularly to neighbours?"
label values NeighbourTalk_wave9 NeighbourTalk_wave9 

//Harrassment - unsafe places

recode i_unsafeo_code (-9=-9) (-8/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4/10=4) (12/16=4) (11=5), gen(UnsafePlace_Wave9)  
label define UnsafePlace_Wave9 -9 "Missing" -2 "Refusal" -1 "Not Applicable" 1 "At school" 2 "at college or university" 3 "at work" 4 "in a public place" 5 "at home", modify
label var UnsafePlace_Wave9 "In the last 12 months where have you felt unsafe?"
label values UnsafePlace_Wave9 UnsafePlace_Wave9  

//Harrasment - avoiding places

recode i_avoidanceo_code (-9=-9) (-8/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4/10=4) (12/16=4) (11=5), gen(AvoidPlace_Wave9)
label define AvoidPlace_Wave9 -9 "Missing" -2 "Refusal" -1 "Not Applicable" 1 "At school" 2 "at college or university" 3 "at work" 4 "in a public place" 5 "at home", modify
label var AvoidPlace_Wave9 "In the last 12 months, did you avoid for any of these reasons? If so, which ones?"
label values AvoidPlace_Wave9 AvoidPlace_Wave9 

//Harrassment - insulted in places    

recode i_insultedo_code (-9=-9) (-8/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4/10=4) (12/16=4) (11=5), gen(InsultedPlace_Wave9)
label define InsultedPlace_Wave9  -9 "Missing" -2 "Refusal" -1 "Not Applicable" 1 "At school" 2 "at college or university" 3 "at work" 4 "in a public place" 5 "at home", modify
label var InsultedPlace_Wave9 "In the last 12 months, have you been insulted, called names, threatened or shouted at, in any of these places? If so, which ones?"
label values InsultedPlace_Wave9 InsultedPlace_Wave9  

//Harrassment - attacked in places

recode i_attackedo_code (-9=-9) (-8/-7=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4/10=4) (12/16=4) (11=5), gen(AttackedPlace_Wave9)
label define AttackedPlace_Wave9 -9 "Missing" -2 "Refusal" -1 "Not Applicable" 1 "At school" 2 "at college or university" 3 "at work" 4 "in a public place" 5 "at home", modify
label var AttackedPlace_Wave9 "In the last 12 months, have you been physically attacked in any of these places? If so, which ones?" 
label values AttackedPlace_Wave9 AttackedPlace_Wave9   

*extent of racial attacks

recode i_crrace (-9/-8=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(raceattacka_wave9)
label define raceattacka_wave9 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var raceattacka_wave9 "How common in your area are insults or attacks to do with someone's race or colour?" 
label values raceattacka_wave9 raceattacka_wave9  

//crime - break ins

recode i_crburg (-9/-8=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(crimebreakina_wave9)
label define crimebreakina_wave9 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var crimebreakina_wave9 "How common in your area are homes broken into?"
label values crimebreakina_wave9 crimebreakina_wave9 

//crime - car stolen

recode i_crcar (-9/-8=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(crimecarestolena_wave9) 
label define crimecarestolena_wave9 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var crimecarestolena_wave9 "How common in your area are cars broken into or stolen?"
label values crimecarestolena_wave9 crimecarestolena_wave9  

//Crime - street attacks

recode i_crmugg (-9/-8=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(crimestreetattacksa_wave9) 
label define crimestreetattacksa_wave9 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var crimestreetattacksa_wave9 "How common in your area are people attacked on the streets?" 
label values crimestreetattacksa_wave9 crimestreetattacksa_wave9

//Area Safety - teenagers hanging around

recode i_crteen (-9/-8=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaSafteyTeen_wave9) 
label define AreaSafteyTeen_wave9 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaSafteyTeen_wave9 "How common in your area are teenagers hanging around in the streets?"
label values AreaSafteyTeen_wave9 AreaSafteyTeen_wave9 

 
//Area Perception - Rubbish

recode i_crrubsh (-9/-8=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionRubbish_wave9)
label define AreaPerceptionRubbish_wave9 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaPerceptionRubbish_wave9 "How common in your area is rubbish or litter lying around?"
label values AreaPerceptionRubbish_wave9 AreaPerceptionRubbish_wave9    

//Area Perception - Graffiti

recode i_crgraf (-9/-8=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionGraffiti_wave9)
label define AreaPerceptionGraffiti_wave9 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaPerceptionGraffiti_wave9 "How common in your area is there graffiti on walls or on buildings?"
label values AreaPerceptionGraffiti_wave9 AreaPerceptionGraffiti_wave9

//Area perception - drunks

recode i_crdrnk (-9/-8=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionDrunks_wave9)
label define AreaPerceptionDrunks_wave9 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify
label var AreaPerceptionDrunks_wave9 "How common in your area are drunks or tramps on the streets?"
label values AreaPerceptionDrunks_wave9 AreaPerceptionDrunks_wave9 

//Area perception - vandalism

recode i_crvand (-9/-8=-1) (-2=-2) (-1=-1) (1=1) (2=2) (3=3) (4=4), gen(AreaPerceptionVandal_wave9)
label define AreaPerceptionVandal_wave9 -2 "refusal" -1 "Not Applicable" 1 "very common" 2 "fairly common" 3 "not very common" 4 "not at all common", modify 
label var AreaPerceptionVandal_wave9 "How common in your area is vandalism and deliberate damage to property?"
label values AreaPerceptionVandal_wave9 AreaPerceptionVandal_wave9 

//Housing tenure

recode i_tenure_dv (-9=-1) (-1=-1) (1/2=1) (3/4=2) (5/7=3) (8=-1), gen(HousingTenure_Wave9)
label define HousingTenure_Wave9 -1 "not applicable" 1 "Owner Occupied" 2 "Social renting" 3 "Private Renting", modify
label var HousingTenure_Wave9 "Housing tenure"
label values HousingTenure_Wave9 HousingTenure_Wave9  

//housing benefit

recode i_renthb (-9=-9) (-8=-1) (-1=-1) (-2=-2) (1=1) (2=2), gen(HousingBenefit_Wave9)
label define HousingBenefit_Wave9 -2 "refusal" -1 "not applicable" 1 "yes" 2 "no", modify
label var HousingBenefit_Wave9 "housing benefit?"
label values HousingBenefit_Wave9 HousingBenefit_Wave9

//Housing tenure since previous wave

recode i_ff_hsownd (-9/-8=-1) (-1=-1) (-2=-2) (1/2=1) (3/4=2) (5/7=3) (8=-1), gen(HousingTenurePrevWave_Wave9)
label define HousingTenurePrevWave_Wave9 -2 "refusal" -1 "not applicable" 1 "Owner Occupied" 2 "Social renting" 3 "Private Renting", modify
label var HousingTenurePrevWave_Wave9 "Housing tenure since last wave" 
label values HousingTenurePrevWave_Wave9 HousingTenurePrevWave_Wave9

// urban or rural area - derived

recode i_urban_dv (-9=-9) (-8=-1) (-1=-1) (-2=-2) (1=1) (2=2), gen(UrbanRural_Wave9)
label define UrbanRural_Wave9 -2 "refusal" -1 "not applicable" 1 "urban" 2 "rural", modify
label var UrbanRural_Wave9 "urban or rural area?"
label values UrbanRural_Wave9 UrbanRural_Wave9


//variables to keep
keep i_hidp i_pno i_intnum pidp PropFriendsArea_Wave9 PropEthnFriend_Wave9  BelongingLocal_wave9 FriendshipLocal_wave9 AdviceLocal_wave9 BorrowLocal_wave9 NeighbourSim_wave9 NeighbourTalk_wave9 UnsafePlace_Wave9 AvoidPlace_Wave9 InsultedPlace_Wave9 AttackedPlace_Wave9 raceattacka_wave9 crimebreakina_wave9 crimecarestolena_wave9 crimestreetattacksa_wave9 AreaSafteyTeen_wave9 AreaPerceptionRubbish_wave9 AreaPerceptionGraffiti_wave9 AreaPerceptionDrunks_wave9 AreaPerceptionVandal_wave9 HousingTenure_Wave9 HousingBenefit_Wave9 HousingTenurePrevWave_Wave9 UrbanRural_Wave9

renvars PropFriendsArea_Wave9 PropEthnFriend_Wave9 UnsafePlace_Wave9 AvoidPlace_Wave9 InsultedPlace_Wave9 AttackedPlace_Wave9 HousingTenure_Wave9 HousingBenefit_Wave9 HousingTenurePrevWave_Wave9 UrbanRural_Wave9, postsub(_Wave9 _wave9)

renvars PropFriendsArea_wave9 - UrbanRural_wave9 , postsub(_wave9 _wave)
gen wave = 9
drop i_hidp i_intnum i_pno

save "...temp\temp_local_w9.dta", replace

******************************
******************************
********* HARASSMENT *********
******************************
******************************

clear all
set more off
capture log close


****************************
* Project: SDAI - together and apart
* Data prep: Understanding Society waves 1-9
* This version: 15/12/2019 (Magda)
*****************************
/*
 Do-files:
	1) master.do (set global directories)
	2) dataprep.do (prepare dataset for analysis)
*/


global user "2"   // 1= Magda 2=James 3=Will

if ${user}==1 {
	global dirdata "U:\data\av\main\current_release\stata\sl\"
	global temp "S:\Magda\SDAI_project\data\"
	global results "S:\Magda\SDAI_project\data\maindata"
	}
if ${user}==2 {
	global dirdata "..."
	global temp "...temp\"
	global results "...temp\"
	}
if ${user}==3 {
	global dirdata ""
	global temp ""
	global results ""
	}

set more off

*create dataset with all vars from the harassment module
    
* Read USoc data
foreach wave in c e g i {
	use "$dirdata\`wave'_indresp", clear
	rename `wave'_* *
	gen wave = index("abcdefghi","`wave'")
	save "$temp\temp_`wave'_indresp", replace
}

* Create dataset with variables common to the harassment module

global base "hidp pno pidp dvage wave country gor_dv"
global harassment "unsafe* resunsafe* avoidance* resavoid* insulted* resinsulted* attacked* resattacked* "

use $base $harassment using "$temp\temp_c_indresp.dta", clear
foreach wave in e g i  {
	append using "$temp\temp_`wave'_indresp.dta", keep($base $harassment)
}

save "$results/harassment.dta", replace 

*******************************************************************************

* recode all vars from the harassment module

/*universe: EM Boost sample or GP Comparison sample or LDA sample or 
Immigrant and Ethnic Minority Boost sample or foreign-born continuing
respondents and their co-resident sample members or any other foreign-born identified this wave
 (inapplicable =-8)
*/
//v1
ge unsafe_anywhere=.
replace unsafe_anywhere=1 if unsafe96==0
replace unsafe_anywhere=0 if unsafe96==1
replace unsafe_anywhere=-8 if unsafe96==-8

lab var unsafe_anywhere "whether felt unsafe in any place"
lab define unsafe_anywhere_lab 0"no" 1"yes" -8"not applicable"
lab val unsafe_anywhere unsafe_anywhere_lab

//v2
ge unsafe_anywhere2=.
replace unsafe_anywhere2=1 if unsafe96==0
replace unsafe_anywhere2=0 if unsafe96==1

lab var unsafe_anywhere2 "whether felt unsafe in any place- no inapplicable"
lab val unsafe_anywhere2 unsafe_anywhere_lab

***
*** Measures of WHERE people felt unsafe 
***

clonevar p_unsafe_schl = unsafe1
clonevar p_unsafe_uni = unsafe2
clonevar p_unsafe_wrk = unsafe3
clonevar p_unsafe_ptran = unsafe4
clonevar p_unsafe_btstn = unsafe5
clonevar p_unsafe_shpc = unsafe6
clonevar p_unsafe_cincf = unsafe7
clonevar p_unsafe_nsoc = unsafe8
clonevar p_unsafe_cpark = unsafe9
clonevar p_unsafe_out = unsafe10
clonevar p_unsafe_home = unsafe11
clonevar p_unsafe_other = unsafe97
label variable p_unsafe_schl "Place(s) felt unsafe: School"
label variable p_unsafe_uni "Place(s) felt unsafe: College/University"
label variable p_unsafe_wrk "Place(s) felt unsafe: at work"
label variable p_unsafe_ptran "Place(s) felt unsafe: On public transport"
label variable p_unsafe_btstn "Place(s) felt unsafe: At/near Bus/train station"
label variable p_unsafe_shpc "Place(s) felt unsafe: In Shopping Centres, etc"
label variable p_unsafe_cincf "Place(s) felt unsafe: In cinema, cafes, etc."
label variable p_unsafe_nsoc "Place(s) felt unsafe: At pub/disco/club"
label variable p_unsafe_cpark "Place(s) felt unsafe: in car parks"
label variable p_unsafe_out "Place(s) felt unsafe: Outside, street/park"
label variable p_unsafe_home "Place(s) felt unsafe: at home"
label variable p_unsafe_other "Place(s) felt unsafe: Other Places"

* Recoding p_unsafe missings

recode p_unsafe_schl- p_unsafe_other (-9=.) (-7/-2=.)

* Recoding 'other places' into p_unsafe variables

replace p_unsafe_wrk = 1 if p_unsafe_wrk!=1 & unsafeo_code==3
replace p_unsafe_ptran = 1 if p_unsafe_ptran!=1 & unsafeo_code==4
replace p_unsafe_btstn = 1 if p_unsafe_btstn!=1 & unsafeo_code==5
replace p_unsafe_shpc = 1 if p_unsafe_shpc!=1 & unsafeo_code==6
replace p_unsafe_cincf = 1 if p_unsafe_cincf!=1 & unsafeo_code==7
replace p_unsafe_nsoc = 1 if p_unsafe_nsoc!=1 & unsafeo_code==8
replace p_unsafe_cpark = 1 if p_unsafe_cpark!=1 & unsafeo_code==9
replace p_unsafe_out = 1 if p_unsafe_out!=1 & unsafeo_code==10
replace p_unsafe_home = 1 if p_unsafe_home!=1 & unsafeo_code==11

* Removing these 'substantive' options from the 'p_unsafe_other' variable

replace p_unsafe_other = 0 if unsafeo_code>2 & unsafeo_code<12

***
*** Measures of WHY people felt unsafe 
***

* Sex

gen r_unsafe_sex = .
replace r_unsafe_sex = 1 if resunsafe1_1==1 | resunsafe1_2==1 | resunsafe1_3==1 | resunsafe1_4==1 | resunsafe1_5==1 | resunsafe1_6==1 | resunsafe1_7==1 | resunsafe1_8==1 | resunsafe1_9==1 | resunsafe1_10==1 | resunsafe1_11==1 | resunsafe1_12==1
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_1==0
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_2==0
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_3==0
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_4==0
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_5==0
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_6==0
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_7==0
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_8==0
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_9==0
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_10==0
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_11==0
replace r_unsafe_sex = 0 if r_unsafe_sex!=1 & resunsafe1_12==0

replace r_unsafe_sex = 0 if (r_unsafe_sex!=1 | r_unsafe_sex!=0) & unsafe_anywhere==0
replace r_unsafe_sex = -8 if (r_unsafe_sex!=1 | r_unsafe_sex!=0) & unsafe_anywhere==-8

label define r_ -8 "Inapplicable" 0 "No" 1 "Yes"
label values r_unsafe_sex r_
label variable r_unsafe_sex "Reason felt unsafe: sex"

* Age

gen r_unsafe_age = .
replace r_unsafe_age = 1 if resunsafe2_1==1 | resunsafe2_2==1 | resunsafe2_3==1 | resunsafe2_4==1 | resunsafe2_5==1 | resunsafe2_6==1 | resunsafe2_7==1 | resunsafe2_8==1 | resunsafe2_9==1 | resunsafe2_10==1 | resunsafe2_11==1 | resunsafe2_12==1
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_1==0
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_2==0
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_3==0
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_4==0
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_5==0
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_6==0
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_7==0
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_8==0
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_9==0
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_10==0
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_11==0
replace r_unsafe_age = 0 if r_unsafe_age!=1 & resunsafe2_12==0

replace r_unsafe_age = 0 if (r_unsafe_age!=1 | r_unsafe_age!=0) & unsafe_anywhere==0
replace r_unsafe_age = -8 if (r_unsafe_age!=1 | r_unsafe_age!=0) & unsafe_anywhere==-8

label values r_unsafe_age r_
label variable r_unsafe_age "Reason felt unsafe: age"

* Ethnicity

gen r_unsafe_eth = .
replace r_unsafe_eth = 1 if resunsafe3_1==1 | resunsafe3_2==1 | resunsafe3_3==1 | resunsafe3_4==1 | resunsafe3_5==1 | resunsafe3_6==1 | resunsafe3_7==1 | resunsafe3_8==1 | resunsafe3_9==1 | resunsafe3_10==1 | resunsafe3_11==1 | resunsafe3_12==1
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_1==0
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_2==0
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_3==0
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_4==0
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_5==0
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_6==0
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_7==0
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_8==0
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_9==0
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_10==0
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_11==0
replace r_unsafe_eth = 0 if r_unsafe_eth!=1 & resunsafe3_12==0

replace r_unsafe_eth = 0 if (r_unsafe_eth!=1 | r_unsafe_eth!=0) & unsafe_anywhere==0
replace r_unsafe_eth = -8 if (r_unsafe_eth!=1 | r_unsafe_eth!=0) & unsafe_anywhere==-8

label values r_unsafe_eth r_
label variable r_unsafe_eth "Reason felt unsafe: ethnicity"

* Sexual Orientation

gen r_unsafe_sexor = .
replace r_unsafe_sexor = 1 if resunsafe4_1==1 | resunsafe4_2==1 | resunsafe4_3==1 | resunsafe4_4==1 | resunsafe4_5==1 | resunsafe4_6==1 | resunsafe4_7==1 | resunsafe4_8==1 | resunsafe4_9==1 | resunsafe4_10==1 | resunsafe4_11==1 | resunsafe4_12==1
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_1==0
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_2==0
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_3==0
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_4==0
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_5==0
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_6==0
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_7==0
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_8==0
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_9==0
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_10==0
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_11==0
replace r_unsafe_sexor = 0 if r_unsafe_sexor!=1 & resunsafe4_12==0

replace r_unsafe_sexor = 0 if (r_unsafe_sexor!=1 | r_unsafe_sexor!=0) & unsafe_anywhere==0
replace r_unsafe_sexor = -8 if (r_unsafe_sexor!=1 | r_unsafe_sexor!=0) & unsafe_anywhere==-8

label values r_unsafe_sexor r_
label variable r_unsafe_sexor "Reason felt unsafe: sexual orientation"

* Disability

gen r_unsafe_hlth = .
replace r_unsafe_hlth = 1 if resunsafe5_1==1 | resunsafe5_2==1 | resunsafe5_3==1 | resunsafe5_4==1 | resunsafe5_5==1 | resunsafe5_6==1 | resunsafe5_7==1 | resunsafe5_8==1 | resunsafe5_9==1 | resunsafe5_10==1 | resunsafe5_11==1 | resunsafe5_12==1
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_1==0
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_2==0
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_3==0
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_4==0
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_5==0
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_6==0
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_7==0
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_8==0
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_9==0
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_10==0
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_11==0
replace r_unsafe_hlth = 0 if r_unsafe_hlth!=1 & resunsafe5_12==0

replace r_unsafe_hlth = 0 if (r_unsafe_hlth!=1 | r_unsafe_hlth!=0) & unsafe_anywhere==0
replace r_unsafe_hlth = -8 if (r_unsafe_hlth!=1 | r_unsafe_hlth!=0) & unsafe_anywhere==-8

label values r_unsafe_hlth r_
label variable r_unsafe_hlth "Reason felt unsafe: health and disability"

* Nationality

gen r_unsafe_nat = .
replace r_unsafe_nat = 1 if resunsafe6_1==1 | resunsafe6_2==1 | resunsafe6_3==1 | resunsafe6_4==1 | resunsafe6_5==1 | resunsafe6_6==1 | resunsafe6_7==1 | resunsafe6_8==1 | resunsafe6_9==1 | resunsafe6_10==1 | resunsafe6_11==1 | resunsafe6_12==1
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_1==0
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_2==0
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_3==0
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_4==0
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_5==0
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_6==0
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_7==0
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_8==0
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_9==0
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_10==0
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_11==0
replace r_unsafe_nat = 0 if r_unsafe_nat!=1 & resunsafe6_12==0

replace r_unsafe_nat = 0 if (r_unsafe_nat!=1 | r_unsafe_nat!=0) & unsafe_anywhere==0
replace r_unsafe_nat = -8 if (r_unsafe_nat!=1 | r_unsafe_nat!=0) & unsafe_anywhere==-8

label values r_unsafe_nat r_
label variable r_unsafe_nat "Reason felt unsafe: nationality"

* Religion

gen r_unsafe_rel = .
replace r_unsafe_rel = 1 if resunsafe7_1==1 | resunsafe7_2==1 | resunsafe7_3==1 | resunsafe7_4==1 | resunsafe7_5==1 | resunsafe7_6==1 | resunsafe7_7==1 | resunsafe7_8==1 | resunsafe7_9==1 | resunsafe7_10==1 | resunsafe7_11==1 | resunsafe7_12==1
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_1==0
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_2==0
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_3==0
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_4==0
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_5==0
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_6==0
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_7==0
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_8==0
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_9==0
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_10==0
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_11==0
replace r_unsafe_rel = 0 if r_unsafe_rel!=1 & resunsafe7_12==0

replace r_unsafe_rel = 0 if (r_unsafe_rel!=1 | r_unsafe_rel!=0) & unsafe_anywhere==0
replace r_unsafe_rel = -8 if (r_unsafe_rel!=1 | r_unsafe_rel!=0) & unsafe_anywhere==-8

label values r_unsafe_rel r_
label variable r_unsafe_rel "Reason felt unsafe: religion"

* Language/Accent

gen r_unsafe_lang = .
replace r_unsafe_lang = 1 if resunsafe8_1==1 | resunsafe8_2==1 | resunsafe8_3==1 | resunsafe8_4==1 | resunsafe8_5==1 | resunsafe8_6==1 | resunsafe8_7==1 | resunsafe8_8==1 | resunsafe8_9==1 | resunsafe8_10==1 | resunsafe8_11==1 | resunsafe8_12==1
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_1==0
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_2==0
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_3==0
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_4==0
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_5==0
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_6==0
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_7==0
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_8==0
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_9==0
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_10==0
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_11==0
replace r_unsafe_lang = 0 if r_unsafe_lang!=1 & resunsafe8_12==0

replace r_unsafe_lang = 0 if (r_unsafe_lang!=1 | r_unsafe_lang!=0) & unsafe_anywhere==0
replace r_unsafe_lang = -8 if (r_unsafe_lang!=1 | r_unsafe_lang!=0) & unsafe_anywhere==-8

label values r_unsafe_lang r_
label variable r_unsafe_lang "Reason felt unsafe: language or accent"

* Language/Accent

gen r_unsafe_drss = .
replace r_unsafe_drss = 1 if resunsafe9_1==1 | resunsafe9_2==1 | resunsafe9_3==1 | resunsafe9_4==1 | resunsafe9_5==1 | resunsafe9_6==1 | resunsafe9_7==1 | resunsafe9_8==1 | resunsafe9_9==1 | resunsafe9_10==1 | resunsafe9_11==1 | resunsafe9_12==1
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_1==0
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_2==0
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_3==0
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_4==0
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_5==0
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_6==0
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_7==0
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_8==0
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_9==0
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_10==0
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_11==0
replace r_unsafe_drss = 0 if r_unsafe_drss!=1 & resunsafe9_12==0

replace r_unsafe_drss = 0 if (r_unsafe_drss!=1 | r_unsafe_drss!=0) & unsafe_anywhere==0
replace r_unsafe_drss = -8 if (r_unsafe_drss!=1 | r_unsafe_drss!=0) & unsafe_anywhere==-8

label values r_unsafe_drss r_
label variable r_unsafe_drss "Reason felt unsafe: appearance or dress"

* Other reason/none of the above

gen r_unsafe_other = .
replace r_unsafe_other = 1 if resunsafe96_1==1 | resunsafe96_2==1 | resunsafe96_3==1 | resunsafe96_4==1 | resunsafe96_5==1 | resunsafe96_6==1 | resunsafe96_7==1 | resunsafe96_8==1 | resunsafe96_9==1 | resunsafe96_10==1 | resunsafe96_11==1 | resunsafe96_12==1
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_1==0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_2==0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_3==0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_4==0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_5==0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_6==0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_7==0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_8==0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_9==0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_10==0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_11==0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe96_12==0

replace r_unsafe_other = 0 if (r_unsafe_other!=1 | r_unsafe_other!=0) & unsafe_anywhere==0
replace r_unsafe_other = -8 if (r_unsafe_other!=1 | r_unsafe_other!=0) & unsafe_anywhere==-8

label values r_unsafe_other r_
label variable r_unsafe_other "Reason felt unsafe: other reason/none of the above"

replace r_unsafe_other = 1 if (resunsafe97_1==1 | resunsafe97_2==1 | resunsafe97_3==1 | resunsafe97_4==1 | resunsafe97_5==1 | resunsafe97_6==1 | resunsafe97_7==1 | resunsafe97_8==1 | resunsafe97_9==1 | resunsafe97_10==1 | resunsafe97_11==1 | resunsafe97_12==1) & r_unsafe_other!=1
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_1==0 & r_unsafe_other!=0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_2==0 & r_unsafe_other!=0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_3==0 & r_unsafe_other!=0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_4==0 & r_unsafe_other!=0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_5==0 & r_unsafe_other!=0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_6==0 & r_unsafe_other!=0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_7==0 & r_unsafe_other!=0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_8==0 & r_unsafe_other!=0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_9==0 & r_unsafe_other!=0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_10==0 & r_unsafe_other!=0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_11==0 & r_unsafe_other!=0
replace r_unsafe_other = 0 if r_unsafe_other!=1 & resunsafe97_12==0 & r_unsafe_other!=0

***
*** Measures of WHY people felt unsafe in particular places
***

* SCHOOL

gen rp_unsafe_schl_sex = 2 if resunsafe1_1==1 & unsafe1==1
replace rp_unsafe_schl_sex = 1 if resunsafe1_1==0 & unsafe1==1
replace rp_unsafe_schl_sex =0 if unsafe1==0
replace rp_unsafe_schl_sex = -1 if unsafe1==-1
replace rp_unsafe_schl_sex = -8 if unsafe1==-8
label define rp_unsafe_schl_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: school" 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_schl_sex rp_unsafe_schl_sex
label variable rp_unsafe_schl_sex "Unsafe - school; sex"

gen rp_unsafe_schl_age = 2 if resunsafe2_1==1 & unsafe1==1
replace rp_unsafe_schl_age = 1 if resunsafe2_1==0 & unsafe1==1
replace rp_unsafe_schl_age =0 if unsafe1==0
replace rp_unsafe_schl_age = -1 if unsafe1==-1
replace rp_unsafe_schl_age = -8 if unsafe1==-8
label define rp_unsafe_schl_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: school" 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_schl_age rp_unsafe_schl_age
label variable rp_unsafe_schl_age "Unsafe - school; age"

gen rp_unsafe_schl_eth = 2 if resunsafe3_1==1 & unsafe1==1
replace rp_unsafe_schl_eth = 1 if resunsafe3_1==0 & unsafe1==1
replace rp_unsafe_schl_eth =0 if unsafe1==0
replace rp_unsafe_schl_eth = -1 if unsafe1==-1
replace rp_unsafe_schl_eth = -8 if unsafe1==-8
label define rp_unsafe_schl_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: school" 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_schl_eth rp_unsafe_schl_eth
label variable rp_unsafe_schl_eth "Unsafe - school; ethnicity"

gen rp_unsafe_schl_sexor = 2 if resunsafe4_1==1 & unsafe1==1
replace rp_unsafe_schl_sexor = 1 if resunsafe4_1==0 & unsafe1==1
replace rp_unsafe_schl_sexor =0 if unsafe1==0
replace rp_unsafe_schl_sexor = -1 if unsafe1==-1
replace rp_unsafe_schl_sexor = -8 if unsafe1==-8
label define rp_unsafe_schl_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: school" 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_schl_sexor rp_unsafe_schl_sexor
label variable rp_unsafe_schl_sexor "Unsafe - school; sexual orientation"

gen rp_unsafe_schl_hlth = 2 if resunsafe5_1==1 & unsafe1==1
replace rp_unsafe_schl_hlth = 1 if resunsafe5_1==0 & unsafe1==1
replace rp_unsafe_schl_hlth =0 if unsafe1==0
replace rp_unsafe_schl_hlth = -1 if unsafe1==-1
replace rp_unsafe_schl_hlth = -8 if unsafe1==-8
label define rp_unsafe_schl_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: school" 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_schl_hlth rp_unsafe_schl_hlth
label variable rp_unsafe_schl_hlth "Unsafe - school; health and disability"

gen rp_unsafe_schl_nat = 2 if resunsafe6_1==1 & unsafe1==1
replace rp_unsafe_schl_nat = 1 if resunsafe6_1==0 & unsafe1==1
replace rp_unsafe_schl_nat =0 if unsafe1==0
replace rp_unsafe_schl_nat = -1 if unsafe1==-1
replace rp_unsafe_schl_nat = -8 if unsafe1==-8
label define rp_unsafe_schl_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: school" 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_schl_nat rp_unsafe_schl_nat
label variable rp_unsafe_schl_nat "Unsafe - school; nationality"

gen rp_unsafe_schl_rel = 2 if resunsafe7_1==1 & unsafe1==1
replace rp_unsafe_schl_rel = 1 if resunsafe7_1==0 & unsafe1==1
replace rp_unsafe_schl_rel =0 if unsafe1==0
replace rp_unsafe_schl_rel = -1 if unsafe1==-1
replace rp_unsafe_schl_rel = -8 if unsafe1==-8
label define rp_unsafe_schl_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: school" 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_schl_rel rp_unsafe_schl_rel
label variable rp_unsafe_schl_rel "Unsafe - school; religion"

gen rp_unsafe_schl_lang = 2 if resunsafe8_1==1 & unsafe1==1
replace rp_unsafe_schl_lang = 1 if resunsafe8_1==0 & unsafe1==1
replace rp_unsafe_schl_lang =0 if unsafe1==0
replace rp_unsafe_schl_lang = -1 if unsafe1==-1
replace rp_unsafe_schl_lang = -8 if unsafe1==-8
label define rp_unsafe_schl_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: school" 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_schl_lang rp_unsafe_schl_lang
label variable rp_unsafe_schl_lang "Unsafe - school; language or accent"

gen rp_unsafe_schl_drss = 2 if resunsafe9_1==1 & unsafe1==1
replace rp_unsafe_schl_drss = 1 if resunsafe9_1==0 & unsafe1==1
replace rp_unsafe_schl_drss =0 if unsafe1==0
replace rp_unsafe_schl_drss = -1 if unsafe1==-1
replace rp_unsafe_schl_drss = -8 if unsafe1==-8
label define rp_unsafe_schl_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: school" 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_schl_drss rp_unsafe_schl_drss
label variable rp_unsafe_schl_drss "Unsafe - school; appearance or dress"

gen rp_unsafe_schl_oth = 2 if resunsafe96_1==1 & unsafe1==1
replace rp_unsafe_schl_oth = 1 if resunsafe96_1==0 & unsafe1==1
replace rp_unsafe_schl_oth =0 if unsafe1==0
replace rp_unsafe_schl_oth = -1 if unsafe1==-1
replace rp_unsafe_schl_oth = -8 if unsafe1==-8
label define rp_unsafe_schl_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: school" 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_schl_oth rp_unsafe_schl_oth
label variable rp_unsafe_schl_oth "Unsafe - school; 'other reason'"
replace rp_unsafe_schl_oth = 2 if resunsafe97_1==1

* In college/uni

gen rp_unsafe_uni_sex = 2 if resunsafe1_2==1 & unsafe2==1
replace rp_unsafe_uni_sex = 1 if resunsafe1_2==0 & unsafe2==1
replace rp_unsafe_uni_sex =0 if unsafe2==0
replace rp_unsafe_uni_sex = -1 if unsafe2==-1
replace rp_unsafe_uni_sex = -8 if unsafe2==-8
label define rp_unsafe_uni_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: college/uni" 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_uni_sex rp_unsafe_uni_sex
label variable rp_unsafe_uni_sex "Unsafe - college/uni; sex"

gen rp_unsafe_uni_age = 2 if resunsafe2_2==1 & unsafe2==1
replace rp_unsafe_uni_age = 1 if resunsafe2_2==0 & unsafe2==1
replace rp_unsafe_uni_age =0 if unsafe2==0
replace rp_unsafe_uni_age = -1 if unsafe2==-1
replace rp_unsafe_uni_age = -8 if unsafe2==-8
label define rp_unsafe_uni_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: college/uni" 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_uni_age rp_unsafe_uni_age
label variable rp_unsafe_uni_age "Unsafe - college/uni; age"

gen rp_unsafe_uni_eth = 2 if resunsafe3_2==1 & unsafe2==1
replace rp_unsafe_uni_eth = 1 if resunsafe3_2==0 & unsafe2==1
replace rp_unsafe_uni_eth =0 if unsafe2==0
replace rp_unsafe_uni_eth = -1 if unsafe2==-1
replace rp_unsafe_uni_eth = -8 if unsafe2==-8
label define rp_unsafe_uni_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: college/uni" 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_uni_eth rp_unsafe_uni_eth
label variable rp_unsafe_uni_eth "Unsafe - college/uni; ethnicity"

gen rp_unsafe_uni_sexor = 2 if resunsafe4_2==1 & unsafe2==1
replace rp_unsafe_uni_sexor = 1 if resunsafe4_2==0 & unsafe2==1
replace rp_unsafe_uni_sexor =0 if unsafe2==0
replace rp_unsafe_uni_sexor = -1 if unsafe2==-1
replace rp_unsafe_uni_sexor = -8 if unsafe2==-8
label define rp_unsafe_uni_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: college/uni" 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_uni_sexor rp_unsafe_uni_sexor
label variable rp_unsafe_uni_sexor "Unsafe - college/uni; sexual orientation"

gen rp_unsafe_uni_hlth = 2 if resunsafe5_2==1 & unsafe2==1
replace rp_unsafe_uni_hlth = 1 if resunsafe5_2==0 & unsafe2==1
replace rp_unsafe_uni_hlth =0 if unsafe2==0
replace rp_unsafe_uni_hlth = -1 if unsafe2==-1
replace rp_unsafe_uni_hlth = -8 if unsafe2==-8
label define rp_unsafe_uni_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: college/uni" 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_uni_hlth rp_unsafe_uni_hlth
label variable rp_unsafe_uni_hlth "Unsafe - college/uni; health and disability"

gen rp_unsafe_uni_nat = 2 if resunsafe6_2==1 & unsafe2==1
replace rp_unsafe_uni_nat = 1 if resunsafe6_2==0 & unsafe2==1
replace rp_unsafe_uni_nat =0 if unsafe2==0
replace rp_unsafe_uni_nat = -1 if unsafe2==-1
replace rp_unsafe_uni_nat = -8 if unsafe2==-8
label define rp_unsafe_uni_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: college/uni" 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_uni_nat rp_unsafe_uni_nat
label variable rp_unsafe_uni_nat "Unsafe - college/uni; nationality"

gen rp_unsafe_uni_rel = 2 if resunsafe7_2==1 & unsafe2==1
replace rp_unsafe_uni_rel = 1 if resunsafe7_2==0 & unsafe2==1
replace rp_unsafe_uni_rel =0 if unsafe2==0
replace rp_unsafe_uni_rel = -1 if unsafe2==-1
replace rp_unsafe_uni_rel = -8 if unsafe2==-8
label define rp_unsafe_uni_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: college/uni" 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_uni_rel rp_unsafe_uni_rel
label variable rp_unsafe_uni_rel "Unsafe - college/uni; religion"

gen rp_unsafe_uni_lang = 2 if resunsafe8_2==1 & unsafe2==1
replace rp_unsafe_uni_lang = 1 if resunsafe8_2==0 & unsafe2==1
replace rp_unsafe_uni_lang =0 if unsafe2==0
replace rp_unsafe_uni_lang = -1 if unsafe2==-1
replace rp_unsafe_uni_lang = -8 if unsafe2==-8
label define rp_unsafe_uni_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: college/uni" 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_uni_lang rp_unsafe_uni_lang
label variable rp_unsafe_uni_lang "Unsafe - college/uni; language or accent"

gen rp_unsafe_uni_drss = 2 if resunsafe9_2==1 & unsafe2==1
replace rp_unsafe_uni_drss = 1 if resunsafe9_2==0 & unsafe2==1
replace rp_unsafe_uni_drss =0 if unsafe2==0
replace rp_unsafe_uni_drss = -1 if unsafe2==-1
replace rp_unsafe_uni_drss = -8 if unsafe2==-8
label define rp_unsafe_uni_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: college/uni" 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_uni_drss rp_unsafe_uni_drss
label variable rp_unsafe_uni_drss "Unsafe - college/uni; appearance or dress"

gen rp_unsafe_uni_oth = 2 if resunsafe96_2==1 & unsafe2==1
replace rp_unsafe_uni_oth = 1 if resunsafe96_2==0 & unsafe2==1
replace rp_unsafe_uni_oth =0 if unsafe2==0
replace rp_unsafe_uni_oth = -1 if unsafe2==-1
replace rp_unsafe_uni_oth = -8 if unsafe2==-8
label define rp_unsafe_uni_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: college/uni" 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_uni_oth rp_unsafe_uni_oth
label variable rp_unsafe_uni_oth "Unsafe - college/uni; 'other reason'"
replace rp_unsafe_uni_oth = 2 if resunsafe97_2==1

* Work

gen rp_unsafe_wrk_sex = 2 if resunsafe1_3==1 & unsafe3==1
replace rp_unsafe_wrk_sex = 1 if resunsafe1_3==0 & unsafe3==1
replace rp_unsafe_wrk_sex =0 if unsafe3==0
replace rp_unsafe_wrk_sex = -1 if unsafe3==-1
replace rp_unsafe_wrk_sex = -8 if unsafe3==-8
label define rp_unsafe_wrk_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: work" 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_wrk_sex rp_unsafe_wrk_sex
label variable rp_unsafe_wrk_sex "Unsafe - work; sex"

gen rp_unsafe_wrk_age = 2 if resunsafe2_3==1 & unsafe3==1
replace rp_unsafe_wrk_age = 1 if resunsafe2_3==0 & unsafe3==1
replace rp_unsafe_wrk_age =0 if unsafe3==0
replace rp_unsafe_wrk_age = -1 if unsafe3==-1
replace rp_unsafe_wrk_age = -8 if unsafe3==-8
label define rp_unsafe_wrk_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: work" 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_wrk_age rp_unsafe_wrk_age
label variable rp_unsafe_wrk_age "Unsafe - work; age"

gen rp_unsafe_wrk_eth = 2 if resunsafe3_3==1 & unsafe3==1
replace rp_unsafe_wrk_eth = 1 if resunsafe3_3==0 & unsafe3==1
replace rp_unsafe_wrk_eth =0 if unsafe3==0
replace rp_unsafe_wrk_eth = -1 if unsafe3==-1
replace rp_unsafe_wrk_eth = -8 if unsafe3==-8
label define rp_unsafe_wrk_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: work" 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_wrk_eth rp_unsafe_wrk_eth
label variable rp_unsafe_wrk_eth "Unsafe - work; ethnicity"

gen rp_unsafe_wrk_sexor = 2 if resunsafe4_3==1 & unsafe3==1
replace rp_unsafe_wrk_sexor = 1 if resunsafe4_3==0 & unsafe3==1
replace rp_unsafe_wrk_sexor =0 if unsafe3==0
replace rp_unsafe_wrk_sexor = -1 if unsafe3==-1
replace rp_unsafe_wrk_sexor = -8 if unsafe3==-8
label define rp_unsafe_wrk_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: work" 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_wrk_sexor rp_unsafe_wrk_sexor
label variable rp_unsafe_wrk_sexor "Unsafe - work; sexual orientation"

gen rp_unsafe_wrk_hlth = 2 if resunsafe5_3==1 & unsafe3==1
replace rp_unsafe_wrk_hlth = 1 if resunsafe5_3==0 & unsafe3==1
replace rp_unsafe_wrk_hlth =0 if unsafe3==0
replace rp_unsafe_wrk_hlth = -1 if unsafe3==-1
replace rp_unsafe_wrk_hlth = -8 if unsafe3==-8
label define rp_unsafe_wrk_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: work" 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_wrk_hlth rp_unsafe_wrk_hlth
label variable rp_unsafe_wrk_hlth "Unsafe - work; health and disability"

gen rp_unsafe_wrk_nat = 2 if resunsafe6_3==1 & unsafe3==1
replace rp_unsafe_wrk_nat = 1 if resunsafe6_3==0 & unsafe3==1
replace rp_unsafe_wrk_nat =0 if unsafe3==0
replace rp_unsafe_wrk_nat = -1 if unsafe3==-1
replace rp_unsafe_wrk_nat = -8 if unsafe3==-8
label define rp_unsafe_wrk_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: work" 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_wrk_nat rp_unsafe_wrk_nat
label variable rp_unsafe_wrk_nat "Unsafe - work; nationality"

gen rp_unsafe_wrk_rel = 2 if resunsafe7_3==1 & unsafe3==1
replace rp_unsafe_wrk_rel = 1 if resunsafe7_3==0 & unsafe3==1
replace rp_unsafe_wrk_rel =0 if unsafe3==0
replace rp_unsafe_wrk_rel = -1 if unsafe3==-1
replace rp_unsafe_wrk_rel = -8 if unsafe3==-8
label define rp_unsafe_wrk_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: work" 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_wrk_rel rp_unsafe_wrk_rel
label variable rp_unsafe_wrk_rel "Unsafe - work; religion"

gen rp_unsafe_wrk_lang = 2 if resunsafe8_3==1 & unsafe3==1
replace rp_unsafe_wrk_lang = 1 if resunsafe8_3==0 & unsafe3==1
replace rp_unsafe_wrk_lang =0 if unsafe3==0
replace rp_unsafe_wrk_lang = -1 if unsafe3==-1
replace rp_unsafe_wrk_lang = -8 if unsafe3==-8
label define rp_unsafe_wrk_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: work" 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_wrk_lang rp_unsafe_wrk_lang
label variable rp_unsafe_wrk_lang "Unsafe - work; language or accent"

gen rp_unsafe_wrk_drss = 2 if resunsafe9_3==1 & unsafe3==1
replace rp_unsafe_wrk_drss = 1 if resunsafe9_3==0 & unsafe3==1
replace rp_unsafe_wrk_drss =0 if unsafe3==0
replace rp_unsafe_wrk_drss = -1 if unsafe3==-1
replace rp_unsafe_wrk_drss = -8 if unsafe3==-8
label define rp_unsafe_wrk_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: work" 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_wrk_drss rp_unsafe_wrk_drss
label variable rp_unsafe_wrk_drss "Unsafe - work; appearance or dress"

gen rp_unsafe_wrk_oth = 2 if resunsafe96_3==1 & unsafe3==1
replace rp_unsafe_wrk_oth = 1 if resunsafe96_3==0 & unsafe3==1
replace rp_unsafe_wrk_oth =0 if unsafe3==0
replace rp_unsafe_wrk_oth = -1 if unsafe3==-1
replace rp_unsafe_wrk_oth = -8 if unsafe3==-8
label define rp_unsafe_wrk_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: work" 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_wrk_oth rp_unsafe_wrk_oth
label variable rp_unsafe_wrk_oth "Unsafe - work; 'other reason'"
replace rp_unsafe_wrk_oth = 2 if resunsafe97_3==1

* Public Transportation

gen rp_unsafe_ptran_sex = 2 if resunsafe1_4==1 & unsafe4==1
replace rp_unsafe_ptran_sex = 1 if resunsafe1_4==0 & unsafe4==1
replace rp_unsafe_ptran_sex =0 if unsafe4==0
replace rp_unsafe_ptran_sex = -1 if unsafe4==-1
replace rp_unsafe_ptran_sex = -8 if unsafe4==-8
label define rp_unsafe_ptran_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pub. trans." 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_ptran_sex rp_unsafe_ptran_sex
label variable rp_unsafe_ptran_sex "Unsafe - public transportation; sex"

gen rp_unsafe_ptran_age = 2 if resunsafe2_4==1 & unsafe4==1
replace rp_unsafe_ptran_age = 1 if resunsafe2_4==0 & unsafe4==1
replace rp_unsafe_ptran_age =0 if unsafe4==0
replace rp_unsafe_ptran_age = -1 if unsafe4==-1
replace rp_unsafe_ptran_age = -8 if unsafe4==-8
label define rp_unsafe_ptran_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pub. trans." 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_ptran_age rp_unsafe_ptran_age
label variable rp_unsafe_ptran_age "Unsafe - public transportation; age"

gen rp_unsafe_ptran_eth = 2 if resunsafe3_4==1 & unsafe4==1
replace rp_unsafe_ptran_eth = 1 if resunsafe3_4==0 & unsafe4==1
replace rp_unsafe_ptran_eth =0 if unsafe4==0
replace rp_unsafe_ptran_eth = -1 if unsafe4==-1
replace rp_unsafe_ptran_eth = -8 if unsafe4==-8
label define rp_unsafe_ptran_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pub. trans." 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_ptran_eth rp_unsafe_ptran_eth
label variable rp_unsafe_ptran_eth "Unsafe - public transportation; ethnicity"

gen rp_unsafe_ptran_sexor = 2 if resunsafe4_4==1 & unsafe4==1
replace rp_unsafe_ptran_sexor = 1 if resunsafe4_4==0 & unsafe4==1
replace rp_unsafe_ptran_sexor =0 if unsafe4==0
replace rp_unsafe_ptran_sexor = -1 if unsafe4==-1
replace rp_unsafe_ptran_sexor = -8 if unsafe4==-8
label define rp_unsafe_ptran_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pub. trans." 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_ptran_sexor rp_unsafe_ptran_sexor
label variable rp_unsafe_ptran_sexor "Unsafe - public transportation; sexual orientation"

gen rp_unsafe_ptran_hlth = 2 if resunsafe5_4==1 & unsafe4==1
replace rp_unsafe_ptran_hlth = 1 if resunsafe5_4==0 & unsafe4==1
replace rp_unsafe_ptran_hlth =0 if unsafe4==0
replace rp_unsafe_ptran_hlth = -1 if unsafe4==-1
replace rp_unsafe_ptran_hlth = -8 if unsafe4==-8
label define rp_unsafe_ptran_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pub. trans." 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_ptran_hlth rp_unsafe_ptran_hlth
label variable rp_unsafe_ptran_hlth "Unsafe - public transportation; health and disability"

gen rp_unsafe_ptran_nat = 2 if resunsafe6_4==1 & unsafe4==1
replace rp_unsafe_ptran_nat = 1 if resunsafe6_4==0 & unsafe4==1
replace rp_unsafe_ptran_nat =0 if unsafe4==0
replace rp_unsafe_ptran_nat = -1 if unsafe4==-1
replace rp_unsafe_ptran_nat = -8 if unsafe4==-8
label define rp_unsafe_ptran_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pub. trans." 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_ptran_nat rp_unsafe_ptran_nat
label variable rp_unsafe_ptran_nat "Unsafe - public transportation; nationality"

gen rp_unsafe_ptran_rel = 2 if resunsafe7_4==1 & unsafe4==1
replace rp_unsafe_ptran_rel = 1 if resunsafe7_4==0 & unsafe4==1
replace rp_unsafe_ptran_rel =0 if unsafe4==0
replace rp_unsafe_ptran_rel = -1 if unsafe4==-1
replace rp_unsafe_ptran_rel = -8 if unsafe4==-8
label define rp_unsafe_ptran_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pub. trans." 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_ptran_rel rp_unsafe_ptran_rel
label variable rp_unsafe_ptran_rel "Unsafe - public transportation; religion"

gen rp_unsafe_ptran_lang = 2 if resunsafe8_4==1 & unsafe4==1
replace rp_unsafe_ptran_lang = 1 if resunsafe8_4==0 & unsafe4==1
replace rp_unsafe_ptran_lang =0 if unsafe4==0
replace rp_unsafe_ptran_lang = -1 if unsafe4==-1
replace rp_unsafe_ptran_lang = -8 if unsafe4==-8
label define rp_unsafe_ptran_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pub. trans." 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_ptran_lang rp_unsafe_ptran_lang
label variable rp_unsafe_ptran_lang "Unsafe - public transportation; language or accent"

gen rp_unsafe_ptran_drss = 2 if resunsafe9_4==1 & unsafe4==1
replace rp_unsafe_ptran_drss = 1 if resunsafe9_4==0 & unsafe4==1
replace rp_unsafe_ptran_drss =0 if unsafe4==0
replace rp_unsafe_ptran_drss = -1 if unsafe4==-1
replace rp_unsafe_ptran_drss = -8 if unsafe4==-8
label define rp_unsafe_ptran_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pub. trans." 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_ptran_drss rp_unsafe_ptran_drss
label variable rp_unsafe_ptran_drss "Unsafe - public transportation; appearance or dress"

gen rp_unsafe_ptran_oth = 2 if resunsafe96_4==1 & unsafe4==1
replace rp_unsafe_ptran_oth = 1 if resunsafe96_4==0 & unsafe4==1
replace rp_unsafe_ptran_oth =0 if unsafe4==0
replace rp_unsafe_ptran_oth = -1 if unsafe4==-1
replace rp_unsafe_ptran_oth = -8 if unsafe4==-8
label define rp_unsafe_ptran_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pub. trans." 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_ptran_oth rp_unsafe_ptran_oth
label variable rp_unsafe_ptran_oth "Unsafe - public transportation	; 'other reason'"
replace rp_unsafe_ptran_oth = 2 if resunsafe97_4==1

* Bus/Train Station

gen rp_unsafe_btstn_sex = 2 if resunsafe1_5==1 & unsafe5==1
replace rp_unsafe_btstn_sex = 1 if resunsafe1_5==0 & unsafe5==1
replace rp_unsafe_btstn_sex =0 if unsafe5==0
replace rp_unsafe_btstn_sex = -1 if unsafe5==-1
replace rp_unsafe_btstn_sex = -8 if unsafe5==-8
label define rp_unsafe_btstn_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: stations" 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_btstn_sex rp_unsafe_btstn_sex
label variable rp_unsafe_btstn_sex "Unsafe - bus/train stations; sex"

gen rp_unsafe_btstn_age = 2 if resunsafe2_5==1 & unsafe5==1
replace rp_unsafe_btstn_age = 1 if resunsafe2_5==0 & unsafe5==1
replace rp_unsafe_btstn_age =0 if unsafe5==0
replace rp_unsafe_btstn_age = -1 if unsafe5==-1
replace rp_unsafe_btstn_age = -8 if unsafe5==-8
label define rp_unsafe_btstn_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: stations" 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_btstn_age rp_unsafe_btstn_age
label variable rp_unsafe_btstn_age "Unsafe - bus/train stations; age"

gen rp_unsafe_btstn_eth = 2 if resunsafe3_5==1 & unsafe5==1
replace rp_unsafe_btstn_eth = 1 if resunsafe3_5==0 & unsafe5==1
replace rp_unsafe_btstn_eth =0 if unsafe5==0
replace rp_unsafe_btstn_eth = -1 if unsafe5==-1
replace rp_unsafe_btstn_eth = -8 if unsafe5==-8
label define rp_unsafe_btstn_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: stations" 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_btstn_eth rp_unsafe_btstn_eth
label variable rp_unsafe_btstn_eth "Unsafe - bus/train stations; ethnicity"

gen rp_unsafe_btstn_sexor = 2 if resunsafe4_5==1 & unsafe5==1
replace rp_unsafe_btstn_sexor = 1 if resunsafe4_5==0 & unsafe5==1
replace rp_unsafe_btstn_sexor =0 if unsafe5==0
replace rp_unsafe_btstn_sexor = -1 if unsafe5==-1
replace rp_unsafe_btstn_sexor = -8 if unsafe5==-8
label define rp_unsafe_btstn_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: stations" 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_btstn_sexor rp_unsafe_btstn_sexor
label variable rp_unsafe_btstn_sexor "Unsafe - bus/train stations; sexual orientation"

gen rp_unsafe_btstn_hlth = 2 if resunsafe5_5==1 & unsafe5==1
replace rp_unsafe_btstn_hlth = 1 if resunsafe5_5==0 & unsafe5==1
replace rp_unsafe_btstn_hlth =0 if unsafe5==0
replace rp_unsafe_btstn_hlth = -1 if unsafe5==-1
replace rp_unsafe_btstn_hlth = -8 if unsafe5==-8
label define rp_unsafe_btstn_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: stations" 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_btstn_hlth rp_unsafe_btstn_hlth
label variable rp_unsafe_btstn_hlth "Unsafe - bus/train stations; health and disability"

gen rp_unsafe_btstn_nat = 2 if resunsafe6_5==1 & unsafe5==1
replace rp_unsafe_btstn_nat = 1 if resunsafe6_5==0 & unsafe5==1
replace rp_unsafe_btstn_nat =0 if unsafe5==0
replace rp_unsafe_btstn_nat = -1 if unsafe5==-1
replace rp_unsafe_btstn_nat = -8 if unsafe5==-8
label define rp_unsafe_btstn_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: stations" 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_btstn_nat rp_unsafe_btstn_nat
label variable rp_unsafe_btstn_nat "Unsafe - bus/train stations; nationality"

gen rp_unsafe_btstn_rel = 2 if resunsafe7_5==1 & unsafe5==1
replace rp_unsafe_btstn_rel = 1 if resunsafe7_5==0 & unsafe5==1
replace rp_unsafe_btstn_rel =0 if unsafe5==0
replace rp_unsafe_btstn_rel = -1 if unsafe5==-1
replace rp_unsafe_btstn_rel = -8 if unsafe5==-8
label define rp_unsafe_btstn_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: stations" 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_btstn_rel rp_unsafe_btstn_rel
label variable rp_unsafe_btstn_rel "Unsafe - bus/train stations; religion"

gen rp_unsafe_btstn_lang = 2 if resunsafe8_5==1 & unsafe5==1
replace rp_unsafe_btstn_lang = 1 if resunsafe8_5==0 & unsafe5==1
replace rp_unsafe_btstn_lang =0 if unsafe5==0
replace rp_unsafe_btstn_lang = -1 if unsafe5==-1
replace rp_unsafe_btstn_lang = -8 if unsafe5==-8
label define rp_unsafe_btstn_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: stations" 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_btstn_lang rp_unsafe_btstn_lang
label variable rp_unsafe_btstn_lang "Unsafe - bus/train stations; language or accent"

gen rp_unsafe_btstn_drss = 2 if resunsafe9_5==1 & unsafe5==1
replace rp_unsafe_btstn_drss = 1 if resunsafe9_5==0 & unsafe5==1
replace rp_unsafe_btstn_drss =0 if unsafe5==0
replace rp_unsafe_btstn_drss = -1 if unsafe5==-1
replace rp_unsafe_btstn_drss = -8 if unsafe5==-8
label define rp_unsafe_btstn_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: stations" 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_btstn_drss rp_unsafe_btstn_drss
label variable rp_unsafe_btstn_drss "Unsafe - bus/train stations; appearance or dress"

gen rp_unsafe_btstn_oth = 2 if resunsafe96_5==1 & unsafe5==1
replace rp_unsafe_btstn_oth = 1 if resunsafe96_5==0 & unsafe5==1
replace rp_unsafe_btstn_oth =0 if unsafe5==0
replace rp_unsafe_btstn_oth = -1 if unsafe5==-1
replace rp_unsafe_btstn_oth = -8 if unsafe5==-8
label define rp_unsafe_btstn_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: stations" 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_btstn_oth rp_unsafe_btstn_oth
label variable rp_unsafe_btstn_oth "Unsafe - bus/train stations; 'other reason'"
replace rp_unsafe_btstn_oth = 2 if resunsafe97_5==1

* Shopping centres

gen rp_unsafe_shpc_sex = 2 if resunsafe1_6==1 & unsafe6==1
replace rp_unsafe_shpc_sex = 1 if resunsafe1_6==0 & unsafe6==1
replace rp_unsafe_shpc_sex =0 if unsafe6==0
replace rp_unsafe_shpc_sex = -1 if unsafe6==-1
replace rp_unsafe_shpc_sex = -8 if unsafe6==-8
label define rp_unsafe_shpc_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: shopping, etc." 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_shpc_sex rp_unsafe_shpc_sex
label variable rp_unsafe_shpc_sex "Unsafe - shopping places; sex"

gen rp_unsafe_shpc_age = 2 if resunsafe2_6==1 & unsafe6==1
replace rp_unsafe_shpc_age = 1 if resunsafe2_6==0 & unsafe6==1
replace rp_unsafe_shpc_age =0 if unsafe6==0
replace rp_unsafe_shpc_age = -1 if unsafe6==-1
replace rp_unsafe_shpc_age = -8 if unsafe6==-8
label define rp_unsafe_shpc_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: shopping, etc." 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_shpc_age rp_unsafe_shpc_age
label variable rp_unsafe_shpc_age "Unsafe - shopping places; age"

gen rp_unsafe_shpc_eth = 2 if resunsafe3_6==1 & unsafe6==1
replace rp_unsafe_shpc_eth = 1 if resunsafe3_6==0 & unsafe6==1
replace rp_unsafe_shpc_eth =0 if unsafe6==0
replace rp_unsafe_shpc_eth = -1 if unsafe6==-1
replace rp_unsafe_shpc_eth = -8 if unsafe6==-8
label define rp_unsafe_shpc_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: shopping, etc." 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_shpc_eth rp_unsafe_shpc_eth
label variable rp_unsafe_shpc_eth "Unsafe - shopping places; ethnicity"

gen rp_unsafe_shpc_sexor = 2 if resunsafe4_6==1 & unsafe6==1
replace rp_unsafe_shpc_sexor = 1 if resunsafe4_6==0 & unsafe6==1
replace rp_unsafe_shpc_sexor =0 if unsafe6==0
replace rp_unsafe_shpc_sexor = -1 if unsafe6==-1
replace rp_unsafe_shpc_sexor = -8 if unsafe6==-8
label define rp_unsafe_shpc_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: shopping, etc." 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_shpc_sexor rp_unsafe_shpc_sexor
label variable rp_unsafe_shpc_sexor "Unsafe - shopping places; sexual orientation"

gen rp_unsafe_shpc_hlth = 2 if resunsafe5_6==1 & unsafe6==1
replace rp_unsafe_shpc_hlth = 1 if resunsafe5_6==0 & unsafe6==1
replace rp_unsafe_shpc_hlth =0 if unsafe6==0
replace rp_unsafe_shpc_hlth = -1 if unsafe6==-1
replace rp_unsafe_shpc_hlth = -8 if unsafe6==-8
label define rp_unsafe_shpc_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: shopping, etc." 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_shpc_hlth rp_unsafe_shpc_hlth
label variable rp_unsafe_shpc_hlth "Unsafe - shopping places; health and disability"

gen rp_unsafe_shpc_nat = 2 if resunsafe6_6==1 & unsafe6==1
replace rp_unsafe_shpc_nat = 1 if resunsafe6_6==0 & unsafe6==1
replace rp_unsafe_shpc_nat =0 if unsafe6==0
replace rp_unsafe_shpc_nat = -1 if unsafe6==-1
replace rp_unsafe_shpc_nat = -8 if unsafe6==-8
label define rp_unsafe_shpc_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: shopping, etc." 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_shpc_nat rp_unsafe_shpc_nat
label variable rp_unsafe_shpc_nat "Unsafe - shopping places; nationality"

gen rp_unsafe_shpc_rel = 2 if resunsafe7_6==1 & unsafe6==1
replace rp_unsafe_shpc_rel = 1 if resunsafe7_6==0 & unsafe6==1
replace rp_unsafe_shpc_rel =0 if unsafe6==0
replace rp_unsafe_shpc_rel = -1 if unsafe6==-1
replace rp_unsafe_shpc_rel = -8 if unsafe6==-8
label define rp_unsafe_shpc_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: shopping, etc." 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_shpc_rel rp_unsafe_shpc_rel
label variable rp_unsafe_shpc_rel "Unsafe - shopping places; religion"

gen rp_unsafe_shpc_lang = 2 if resunsafe8_6==1 & unsafe6==1
replace rp_unsafe_shpc_lang = 1 if resunsafe8_6==0 & unsafe6==1
replace rp_unsafe_shpc_lang =0 if unsafe6==0
replace rp_unsafe_shpc_lang = -1 if unsafe6==-1
replace rp_unsafe_shpc_lang = -8 if unsafe6==-8
label define rp_unsafe_shpc_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: shopping, etc." 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_shpc_lang rp_unsafe_shpc_lang
label variable rp_unsafe_shpc_lang "Unsafe - shopping places; language or accent"

gen rp_unsafe_shpc_drss = 2 if resunsafe9_6==1 & unsafe6==1
replace rp_unsafe_shpc_drss = 1 if resunsafe9_6==0 & unsafe6==1
replace rp_unsafe_shpc_drss =0 if unsafe6==0
replace rp_unsafe_shpc_drss = -1 if unsafe6==-1
replace rp_unsafe_shpc_drss = -8 if unsafe6==-8
label define rp_unsafe_shpc_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: shopping, etc." 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_shpc_drss rp_unsafe_shpc_drss
label variable rp_unsafe_shpc_drss "Unsafe - shopping places; appearance or dress"

gen rp_unsafe_shpc_oth = 2 if resunsafe96_6==1 & unsafe6==1
replace rp_unsafe_shpc_oth = 1 if resunsafe96_6==0 & unsafe6==1
replace rp_unsafe_shpc_oth =0 if unsafe6==0
replace rp_unsafe_shpc_oth = -1 if unsafe6==-1
replace rp_unsafe_shpc_oth = -8 if unsafe6==-8
label define rp_unsafe_shpc_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: shopping, etc." 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_shpc_oth rp_unsafe_shpc_oth
label variable rp_unsafe_shpc_oth "Unsafe - shopping places; 'other reason'"
replace rp_unsafe_shpc_oth = 2 if resunsafe97_6==1

* In cinema, cafes, etc

gen rp_unsafe_cincf_sex = 2 if resunsafe1_7==1 & unsafe7==1
replace rp_unsafe_cincf_sex = 1 if resunsafe1_7==0 & unsafe7==1
replace rp_unsafe_cincf_sex =0 if unsafe7==0
replace rp_unsafe_cincf_sex = -1 if unsafe7==-1
replace rp_unsafe_cincf_sex = -8 if unsafe7==-8
label define rp_unsafe_cincf_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: cinemas, cafes, etc." 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_cincf_sex rp_unsafe_cincf_sex
label variable rp_unsafe_cincf_sex "Unsafe - cinema, cafes, etc.; sex"

gen rp_unsafe_cincf_age = 2 if resunsafe2_7==1 & unsafe7==1
replace rp_unsafe_cincf_age = 1 if resunsafe2_7==0 & unsafe7==1
replace rp_unsafe_cincf_age =0 if unsafe7==0
replace rp_unsafe_cincf_age = -1 if unsafe7==-1
replace rp_unsafe_cincf_age = -8 if unsafe7==-8
label define rp_unsafe_cincf_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: cinemas, cafes, etc." 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_cincf_age rp_unsafe_cincf_age
label variable rp_unsafe_cincf_age "Unsafe - cinema, cafes, etc.; age"

gen rp_unsafe_cincf_eth = 2 if resunsafe3_7==1 & unsafe7==1
replace rp_unsafe_cincf_eth = 1 if resunsafe3_7==0 & unsafe7==1
replace rp_unsafe_cincf_eth =0 if unsafe7==0
replace rp_unsafe_cincf_eth = -1 if unsafe7==-1
replace rp_unsafe_cincf_eth = -8 if unsafe7==-8
label define rp_unsafe_cincf_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: cinemas, cafes, etc." 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_cincf_eth rp_unsafe_cincf_eth
label variable rp_unsafe_cincf_eth "Unsafe - cinema, cafes, etc.; ethnicity"

gen rp_unsafe_cincf_sexor = 2 if resunsafe4_7==1 & unsafe7==1
replace rp_unsafe_cincf_sexor = 1 if resunsafe4_7==0 & unsafe7==1
replace rp_unsafe_cincf_sexor =0 if unsafe7==0
replace rp_unsafe_cincf_sexor = -1 if unsafe7==-1
replace rp_unsafe_cincf_sexor = -8 if unsafe7==-8
label define rp_unsafe_cincf_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: cinemas, cafes, etc." 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_cincf_sexor rp_unsafe_cincf_sexor
label variable rp_unsafe_cincf_sexor "Unsafe - cinema, cafes, etc.; sexual orientation"

gen rp_unsafe_cincf_hlth = 2 if resunsafe5_7==1 & unsafe7==1
replace rp_unsafe_cincf_hlth = 1 if resunsafe5_7==0 & unsafe7==1
replace rp_unsafe_cincf_hlth =0 if unsafe7==0
replace rp_unsafe_cincf_hlth = -1 if unsafe7==-1
replace rp_unsafe_cincf_hlth = -8 if unsafe7==-8
label define rp_unsafe_cincf_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: cinemas, cafes, etc." 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_cincf_hlth rp_unsafe_cincf_hlth
label variable rp_unsafe_cincf_hlth "Unsafe - cinema, cafes, etc.; health and disability"

gen rp_unsafe_cincf_nat = 2 if resunsafe6_7==1 & unsafe7==1
replace rp_unsafe_cincf_nat = 1 if resunsafe6_7==0 & unsafe7==1
replace rp_unsafe_cincf_nat =0 if unsafe7==0
replace rp_unsafe_cincf_nat = -1 if unsafe7==-1
replace rp_unsafe_cincf_nat = -8 if unsafe7==-8
label define rp_unsafe_cincf_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: cinemas, cafes, etc." 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_cincf_nat rp_unsafe_cincf_nat
label variable rp_unsafe_cincf_nat "Unsafe - cinema, cafes, etc.; nationality"

gen rp_unsafe_cincf_rel = 2 if resunsafe7_7==1 & unsafe7==1
replace rp_unsafe_cincf_rel = 1 if resunsafe7_7==0 & unsafe7==1
replace rp_unsafe_cincf_rel =0 if unsafe7==0
replace rp_unsafe_cincf_rel = -1 if unsafe7==-1
replace rp_unsafe_cincf_rel = -8 if unsafe7==-8
label define rp_unsafe_cincf_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: cinemas, cafes, etc." 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_cincf_rel rp_unsafe_cincf_rel
label variable rp_unsafe_cincf_rel "Unsafe - cinema, cafes, etc.; religion"

gen rp_unsafe_cincf_lang = 2 if resunsafe8_7==1 & unsafe7==1
replace rp_unsafe_cincf_lang = 1 if resunsafe8_7==0 & unsafe7==1
replace rp_unsafe_cincf_lang =0 if unsafe7==0
replace rp_unsafe_cincf_lang = -1 if unsafe7==-1
replace rp_unsafe_cincf_lang = -8 if unsafe7==-8
label define rp_unsafe_cincf_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: cinemas, cafes, etc." 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_cincf_lang rp_unsafe_cincf_lang
label variable rp_unsafe_cincf_lang "Unsafe - cinema, cafes, etc.; language or accent"

gen rp_unsafe_cincf_drss = 2 if resunsafe9_7==1 & unsafe7==1
replace rp_unsafe_cincf_drss = 1 if resunsafe9_7==0 & unsafe7==1
replace rp_unsafe_cincf_drss =0 if unsafe7==0
replace rp_unsafe_cincf_drss = -1 if unsafe7==-1
replace rp_unsafe_cincf_drss = -8 if unsafe7==-8
label define rp_unsafe_cincf_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: cinemas, cafes, etc." 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_cincf_drss rp_unsafe_cincf_drss
label variable rp_unsafe_cincf_drss "Unsafe - cinema, cafes, etc.; appearance or dress"

gen rp_unsafe_cincf_oth = 2 if resunsafe96_7==1 & unsafe7==1
replace rp_unsafe_cincf_oth = 1 if resunsafe96_7==0 & unsafe7==1
replace rp_unsafe_cincf_oth =0 if unsafe7==0
replace rp_unsafe_cincf_oth = -1 if unsafe7==-1
replace rp_unsafe_cincf_oth = -8 if unsafe7==-8
label define rp_unsafe_cincf_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: cinemas, cafes, etc." 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_cincf_oth rp_unsafe_cincf_oth
label variable rp_unsafe_cincf_oth "Unsafe - cinema, cafes, etc.; 'other reason'"
replace rp_unsafe_cincf_oth = 2 if resunsafe97_7==1

* Pubs, Discos, Night Clubs, etc.

gen rp_unsafe_nsoc_sex = 2 if resunsafe1_8==1 & unsafe8==1
replace rp_unsafe_nsoc_sex = 1 if resunsafe1_8==0 & unsafe8==1
replace rp_unsafe_nsoc_sex =0 if unsafe8==0
replace rp_unsafe_nsoc_sex = -1 if unsafe8==-1
replace rp_unsafe_nsoc_sex = -8 if unsafe8==-8
label define rp_unsafe_nsoc_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pubs, clubs, etc." 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_nsoc_sex rp_unsafe_nsoc_sex
label variable rp_unsafe_nsoc_sex "Unsafe - Pubs, Clubs, Discos; sex"

gen rp_unsafe_nsoc_age = 2 if resunsafe2_8==1 & unsafe8==1
replace rp_unsafe_nsoc_age = 1 if resunsafe2_8==0 & unsafe8==1
replace rp_unsafe_nsoc_age =0 if unsafe8==0
replace rp_unsafe_nsoc_age = -1 if unsafe8==-1
replace rp_unsafe_nsoc_age = -8 if unsafe8==-8
label define rp_unsafe_nsoc_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pubs, clubs, etc." 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_nsoc_age rp_unsafe_nsoc_age
label variable rp_unsafe_nsoc_age "Unsafe - Pubs, Clubs, Discos; age"

gen rp_unsafe_nsoc_eth = 2 if resunsafe3_8==1 & unsafe8==1
replace rp_unsafe_nsoc_eth = 1 if resunsafe3_8==0 & unsafe8==1
replace rp_unsafe_nsoc_eth =0 if unsafe8==0
replace rp_unsafe_nsoc_eth = -1 if unsafe8==-1
replace rp_unsafe_nsoc_eth = -8 if unsafe8==-8
label define rp_unsafe_nsoc_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pubs, clubs, etc." 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_nsoc_eth rp_unsafe_nsoc_eth
label variable rp_unsafe_nsoc_eth "Unsafe - Pubs, Clubs, Discos; ethnicity"

gen rp_unsafe_nsoc_sexor = 2 if resunsafe4_8==1 & unsafe8==1
replace rp_unsafe_nsoc_sexor = 1 if resunsafe4_8==0 & unsafe8==1
replace rp_unsafe_nsoc_sexor =0 if unsafe8==0
replace rp_unsafe_nsoc_sexor = -1 if unsafe8==-1
replace rp_unsafe_nsoc_sexor = -8 if unsafe8==-8
label define rp_unsafe_nsoc_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pubs, clubs, etc." 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_nsoc_sexor rp_unsafe_nsoc_sexor
label variable rp_unsafe_nsoc_sexor "Unsafe - Pubs, Clubs, Discos; sexual orientation"

gen rp_unsafe_nsoc_hlth = 2 if resunsafe5_8==1 & unsafe8==1
replace rp_unsafe_nsoc_hlth = 1 if resunsafe5_8==0 & unsafe8==1
replace rp_unsafe_nsoc_hlth =0 if unsafe8==0
replace rp_unsafe_nsoc_hlth = -1 if unsafe8==-1
replace rp_unsafe_nsoc_hlth = -8 if unsafe8==-8
label define rp_unsafe_nsoc_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pubs, clubs, etc." 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_nsoc_hlth rp_unsafe_nsoc_hlth
label variable rp_unsafe_nsoc_hlth "Unsafe - Pubs, Clubs, Discos; health and disability"

gen rp_unsafe_nsoc_nat = 2 if resunsafe6_8==1 & unsafe8==1
replace rp_unsafe_nsoc_nat = 1 if resunsafe6_8==0 & unsafe8==1
replace rp_unsafe_nsoc_nat =0 if unsafe8==0
replace rp_unsafe_nsoc_nat = -1 if unsafe8==-1
replace rp_unsafe_nsoc_nat = -8 if unsafe8==-8
label define rp_unsafe_nsoc_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pubs, clubs, etc." 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_nsoc_nat rp_unsafe_nsoc_nat
label variable rp_unsafe_nsoc_nat "Unsafe - Pubs, Clubs, Discos; nationality"

gen rp_unsafe_nsoc_rel = 2 if resunsafe7_8==1 & unsafe8==1
replace rp_unsafe_nsoc_rel = 1 if resunsafe7_8==0 & unsafe8==1
replace rp_unsafe_nsoc_rel =0 if unsafe8==0
replace rp_unsafe_nsoc_rel = -1 if unsafe8==-1
replace rp_unsafe_nsoc_rel = -8 if unsafe8==-8
label define rp_unsafe_nsoc_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pubs, clubs, etc." 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_nsoc_rel rp_unsafe_nsoc_rel
label variable rp_unsafe_nsoc_rel "Unsafe - Pubs, Clubs, Discos; religion"

gen rp_unsafe_nsoc_lang = 2 if resunsafe8_8==1 & unsafe8==1
replace rp_unsafe_nsoc_lang = 1 if resunsafe8_8==0 & unsafe8==1
replace rp_unsafe_nsoc_lang =0 if unsafe8==0
replace rp_unsafe_nsoc_lang = -1 if unsafe8==-1
replace rp_unsafe_nsoc_lang = -8 if unsafe8==-8
label define rp_unsafe_nsoc_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pubs, clubs, etc." 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_nsoc_lang rp_unsafe_nsoc_lang
label variable rp_unsafe_nsoc_lang "Unsafe - Pubs, Clubs, Discos; language or accent"

gen rp_unsafe_nsoc_drss = 2 if resunsafe9_8==1 & unsafe8==1
replace rp_unsafe_nsoc_drss = 1 if resunsafe9_8==0 & unsafe8==1
replace rp_unsafe_nsoc_drss =0 if unsafe8==0
replace rp_unsafe_nsoc_drss = -1 if unsafe8==-1
replace rp_unsafe_nsoc_drss = -8 if unsafe8==-8
label define rp_unsafe_nsoc_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pubs, clubs, etc." 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_nsoc_drss rp_unsafe_nsoc_drss
label variable rp_unsafe_nsoc_drss "Unsafe - Pubs, Clubs, Discos; appearance or dress"

gen rp_unsafe_nsoc_oth = 2 if resunsafe96_8==1 & unsafe8==1
replace rp_unsafe_nsoc_oth = 1 if resunsafe96_8==0 & unsafe8==1
replace rp_unsafe_nsoc_oth =0 if unsafe8==0
replace rp_unsafe_nsoc_oth = -1 if unsafe8==-1
replace rp_unsafe_nsoc_oth = -8 if unsafe8==-8
label define rp_unsafe_nsoc_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: pubs, clubs, etc." 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_nsoc_oth rp_unsafe_nsoc_oth
label variable rp_unsafe_nsoc_oth "Unsafe - Pubs, Clubs, Discos	; 'other reason'"
replace rp_unsafe_nsoc_oth = 2 if resunsafe97_8==1

* Car Parks

gen rp_unsafe_cpark_sex = 2 if resunsafe1_9==1 & unsafe9==1
replace rp_unsafe_cpark_sex = 1 if resunsafe1_9==0 & unsafe9==1
replace rp_unsafe_cpark_sex =0 if unsafe9==0
replace rp_unsafe_cpark_sex = -1 if unsafe9==-1
replace rp_unsafe_cpark_sex = -8 if unsafe9==-8
label define rp_unsafe_cpark_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: Car parks" 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_cpark_sex rp_unsafe_cpark_sex
label variable rp_unsafe_cpark_sex "Unsafe - Car Parks; sex"

gen rp_unsafe_cpark_age = 2 if resunsafe2_9==1 & unsafe9==1
replace rp_unsafe_cpark_age = 1 if resunsafe2_9==0 & unsafe9==1
replace rp_unsafe_cpark_age =0 if unsafe9==0
replace rp_unsafe_cpark_age = -1 if unsafe9==-1
replace rp_unsafe_cpark_age = -8 if unsafe9==-8
label define rp_unsafe_cpark_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: Car parks" 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_cpark_age rp_unsafe_cpark_age
label variable rp_unsafe_cpark_age "Unsafe - Car Parks; age"

gen rp_unsafe_cpark_eth = 2 if resunsafe3_9==1 & unsafe9==1
replace rp_unsafe_cpark_eth = 1 if resunsafe3_9==0 & unsafe9==1
replace rp_unsafe_cpark_eth =0 if unsafe9==0
replace rp_unsafe_cpark_eth = -1 if unsafe9==-1
replace rp_unsafe_cpark_eth = -8 if unsafe9==-8
label define rp_unsafe_cpark_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: Car parks" 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_cpark_eth rp_unsafe_cpark_eth
label variable rp_unsafe_cpark_eth "Unsafe - Car Parks; ethnicity"

gen rp_unsafe_cpark_sexor = 2 if resunsafe4_9==1 & unsafe9==1
replace rp_unsafe_cpark_sexor = 1 if resunsafe4_9==0 & unsafe9==1
replace rp_unsafe_cpark_sexor =0 if unsafe9==0
replace rp_unsafe_cpark_sexor = -1 if unsafe9==-1
replace rp_unsafe_cpark_sexor = -8 if unsafe9==-8
label define rp_unsafe_cpark_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: Car parks" 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_cpark_sexor rp_unsafe_cpark_sexor
label variable rp_unsafe_cpark_sexor "Unsafe - Car Parks; sexual orientation"

gen rp_unsafe_cpark_hlth = 2 if resunsafe5_9==1 & unsafe9==1
replace rp_unsafe_cpark_hlth = 1 if resunsafe5_9==0 & unsafe9==1
replace rp_unsafe_cpark_hlth =0 if unsafe9==0
replace rp_unsafe_cpark_hlth = -1 if unsafe9==-1
replace rp_unsafe_cpark_hlth = -8 if unsafe9==-8
label define rp_unsafe_cpark_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: Car parks" 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_cpark_hlth rp_unsafe_cpark_hlth
label variable rp_unsafe_cpark_hlth "Unsafe - Car Parks; health and disability"

gen rp_unsafe_cpark_nat = 2 if resunsafe6_9==1 & unsafe9==1
replace rp_unsafe_cpark_nat = 1 if resunsafe6_9==0 & unsafe9==1
replace rp_unsafe_cpark_nat =0 if unsafe9==0
replace rp_unsafe_cpark_nat = -1 if unsafe9==-1
replace rp_unsafe_cpark_nat = -8 if unsafe9==-8
label define rp_unsafe_cpark_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: Car parks" 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_cpark_nat rp_unsafe_cpark_nat
label variable rp_unsafe_cpark_nat "Unsafe - Car Parks; nationality"

gen rp_unsafe_cpark_rel = 2 if resunsafe7_9==1 & unsafe9==1
replace rp_unsafe_cpark_rel = 1 if resunsafe7_9==0 & unsafe9==1
replace rp_unsafe_cpark_rel =0 if unsafe9==0
replace rp_unsafe_cpark_rel = -1 if unsafe9==-1
replace rp_unsafe_cpark_rel = -8 if unsafe9==-8
label define rp_unsafe_cpark_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: Car parks" 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_cpark_rel rp_unsafe_cpark_rel
label variable rp_unsafe_cpark_rel "Unsafe - Car Parks; religion"

gen rp_unsafe_cpark_lang = 2 if resunsafe8_9==1 & unsafe9==1
replace rp_unsafe_cpark_lang = 1 if resunsafe8_9==0 & unsafe9==1
replace rp_unsafe_cpark_lang =0 if unsafe9==0
replace rp_unsafe_cpark_lang = -1 if unsafe9==-1
replace rp_unsafe_cpark_lang = -8 if unsafe9==-8
label define rp_unsafe_cpark_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: Car parks" 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_cpark_lang rp_unsafe_cpark_lang
label variable rp_unsafe_cpark_lang "Unsafe - Car Parks; language or accent"

gen rp_unsafe_cpark_drss = 2 if resunsafe9_9==1 & unsafe9==1
replace rp_unsafe_cpark_drss = 1 if resunsafe9_9==0 & unsafe9==1
replace rp_unsafe_cpark_drss =0 if unsafe9==0
replace rp_unsafe_cpark_drss = -1 if unsafe9==-1
replace rp_unsafe_cpark_drss = -8 if unsafe9==-8
label define rp_unsafe_cpark_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: Car parks" 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_cpark_drss rp_unsafe_cpark_drss
label variable rp_unsafe_cpark_drss "Unsafe - Car Parks; appearance or dress"

gen rp_unsafe_cpark_oth = 2 if resunsafe96_9==1 & unsafe9==1
replace rp_unsafe_cpark_oth = 1 if resunsafe96_9==0 & unsafe9==1
replace rp_unsafe_cpark_oth =0 if unsafe9==0
replace rp_unsafe_cpark_oth = -1 if unsafe9==-1
replace rp_unsafe_cpark_oth = -8 if unsafe9==-8
label define rp_unsafe_cpark_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: Car parks" 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_cpark_oth rp_unsafe_cpark_oth
label variable rp_unsafe_cpark_oth "Unsafe - Car Parks; 'other reason'"
replace rp_unsafe_cpark_oth = 2 if resunsafe97_9==1

* Outside (streets/parks)

gen rp_unsafe_out_sex = 2 if resunsafe1_10==1 & unsafe10==1
replace rp_unsafe_out_sex = 1 if resunsafe1_10==0 & unsafe10==1
replace rp_unsafe_out_sex =0 if unsafe10==0
replace rp_unsafe_out_sex = -1 if unsafe10==-1
replace rp_unsafe_out_sex = -8 if unsafe10==-8
label define rp_unsafe_out_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: outside (streets, parks, etc.)" 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_out_sex rp_unsafe_out_sex
label variable rp_unsafe_out_sex "Unsafe - outside (streets, parks, etc.); sex"

gen rp_unsafe_out_age = 2 if resunsafe2_10==1 & unsafe10==1
replace rp_unsafe_out_age = 1 if resunsafe2_10==0 & unsafe10==1
replace rp_unsafe_out_age =0 if unsafe10==0
replace rp_unsafe_out_age = -1 if unsafe10==-1
replace rp_unsafe_out_age = -8 if unsafe10==-8
label define rp_unsafe_out_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: outside (streets, parks, etc.)" 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_out_age rp_unsafe_out_age
label variable rp_unsafe_out_age "Unsafe - outside (streets, parks, etc.); age"

gen rp_unsafe_out_eth = 2 if resunsafe3_10==1 & unsafe10==1
replace rp_unsafe_out_eth = 1 if resunsafe3_10==0 & unsafe10==1
replace rp_unsafe_out_eth =0 if unsafe10==0
replace rp_unsafe_out_eth = -1 if unsafe10==-1
replace rp_unsafe_out_eth = -8 if unsafe10==-8
label define rp_unsafe_out_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: outside (streets, parks, etc.)" 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_out_eth rp_unsafe_out_eth
label variable rp_unsafe_out_eth "Unsafe - outside (streets, parks, etc.); ethnicity"

gen rp_unsafe_out_sexor = 2 if resunsafe4_10==1 & unsafe10==1
replace rp_unsafe_out_sexor = 1 if resunsafe4_10==0 & unsafe10==1
replace rp_unsafe_out_sexor =0 if unsafe10==0
replace rp_unsafe_out_sexor = -1 if unsafe10==-1
replace rp_unsafe_out_sexor = -8 if unsafe10==-8
label define rp_unsafe_out_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: outside (streets, parks, etc.)" 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_out_sexor rp_unsafe_out_sexor
label variable rp_unsafe_out_sexor "Unsafe - outside (streets, parks, etc.); sexual orientation"

gen rp_unsafe_out_hlth = 2 if resunsafe5_10==1 & unsafe10==1
replace rp_unsafe_out_hlth = 1 if resunsafe5_10==0 & unsafe10==1
replace rp_unsafe_out_hlth =0 if unsafe10==0
replace rp_unsafe_out_hlth = -1 if unsafe10==-1
replace rp_unsafe_out_hlth = -8 if unsafe10==-8
label define rp_unsafe_out_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: outside (streets, parks, etc.)" 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_out_hlth rp_unsafe_out_hlth
label variable rp_unsafe_out_hlth "Unsafe - outside (streets, parks, etc.); health and disability"

gen rp_unsafe_out_nat = 2 if resunsafe6_10==1 & unsafe10==1
replace rp_unsafe_out_nat = 1 if resunsafe6_10==0 & unsafe10==1
replace rp_unsafe_out_nat =0 if unsafe10==0
replace rp_unsafe_out_nat = -1 if unsafe10==-1
replace rp_unsafe_out_nat = -8 if unsafe10==-8
label define rp_unsafe_out_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: outside (streets, parks, etc.)" 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_out_nat rp_unsafe_out_nat
label variable rp_unsafe_out_nat "Unsafe - outside (streets, parks, etc.); nationality"

gen rp_unsafe_out_rel = 2 if resunsafe7_10==1 & unsafe10==1
replace rp_unsafe_out_rel = 1 if resunsafe7_10==0 & unsafe10==1
replace rp_unsafe_out_rel =0 if unsafe10==0
replace rp_unsafe_out_rel = -1 if unsafe10==-1
replace rp_unsafe_out_rel = -8 if unsafe10==-8
label define rp_unsafe_out_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: outside (streets, parks, etc.)" 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_out_rel rp_unsafe_out_rel
label variable rp_unsafe_out_rel "Unsafe - outside (streets, parks, etc.); religion"

gen rp_unsafe_out_lang = 2 if resunsafe8_10==1 & unsafe10==1
replace rp_unsafe_out_lang = 1 if resunsafe8_10==0 & unsafe10==1
replace rp_unsafe_out_lang =0 if unsafe10==0
replace rp_unsafe_out_lang = -1 if unsafe10==-1
replace rp_unsafe_out_lang = -8 if unsafe10==-8
label define rp_unsafe_out_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: outside (streets, parks, etc.)" 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_out_lang rp_unsafe_out_lang
label variable rp_unsafe_out_lang "Unsafe - outside (streets, parks, etc.); language or accent"

gen rp_unsafe_out_drss = 2 if resunsafe9_10==1 & unsafe10==1
replace rp_unsafe_out_drss = 1 if resunsafe9_10==0 & unsafe10==1
replace rp_unsafe_out_drss =0 if unsafe10==0
replace rp_unsafe_out_drss = -1 if unsafe10==-1
replace rp_unsafe_out_drss = -8 if unsafe10==-8
label define rp_unsafe_out_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: outside (streets, parks, etc.)" 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_out_drss rp_unsafe_out_drss
label variable rp_unsafe_out_drss "Unsafe - outside (streets, parks, etc.); appearance or dress"

gen rp_unsafe_out_oth = 2 if resunsafe96_10==1 & unsafe10==1
replace rp_unsafe_out_oth = 1 if resunsafe96_10==0 & unsafe10==1
replace rp_unsafe_out_oth =0 if unsafe10==0
replace rp_unsafe_out_oth = -1 if unsafe10==-1
replace rp_unsafe_out_oth = -8 if unsafe10==-8
label define rp_unsafe_out_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: outside (streets, parks, etc.)" 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_out_oth rp_unsafe_out_oth
label variable rp_unsafe_out_oth "Unsafe - outside (streets, parks, etc.); 'other reason'"
replace rp_unsafe_out_oth = 2 if resunsafe97_10==1

* Home

gen rp_unsafe_home_sex = 2 if resunsafe1_11==1 & unsafe11==1
replace rp_unsafe_home_sex = 1 if resunsafe1_11==0 & unsafe11==1
replace rp_unsafe_home_sex =0 if unsafe11==0
replace rp_unsafe_home_sex = -1 if unsafe11==-1
replace rp_unsafe_home_sex = -8 if unsafe11==-8
label define rp_unsafe_home_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: at home" 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_home_sex rp_unsafe_home_sex
label variable rp_unsafe_home_sex "Unsafe - at home; sex"

gen rp_unsafe_home_age = 2 if resunsafe2_11==1 & unsafe11==1
replace rp_unsafe_home_age = 1 if resunsafe2_11==0 & unsafe11==1
replace rp_unsafe_home_age =0 if unsafe11==0
replace rp_unsafe_home_age = -1 if unsafe11==-1
replace rp_unsafe_home_age = -8 if unsafe11==-8
label define rp_unsafe_home_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: at home" 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_home_age rp_unsafe_home_age
label variable rp_unsafe_home_age "Unsafe - at home; age"

gen rp_unsafe_home_eth = 2 if resunsafe3_11==1 & unsafe11==1
replace rp_unsafe_home_eth = 1 if resunsafe3_11==0 & unsafe11==1
replace rp_unsafe_home_eth =0 if unsafe11==0
replace rp_unsafe_home_eth = -1 if unsafe11==-1
replace rp_unsafe_home_eth = -8 if unsafe11==-8
label define rp_unsafe_home_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: at home" 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_home_eth rp_unsafe_home_eth
label variable rp_unsafe_home_eth "Unsafe - at home; ethnicity"

gen rp_unsafe_home_sexor = 2 if resunsafe4_11==1 & unsafe11==1
replace rp_unsafe_home_sexor = 1 if resunsafe4_11==0 & unsafe11==1
replace rp_unsafe_home_sexor =0 if unsafe11==0
replace rp_unsafe_home_sexor = -1 if unsafe11==-1
replace rp_unsafe_home_sexor = -8 if unsafe11==-8
label define rp_unsafe_home_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: at home" 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_home_sexor rp_unsafe_home_sexor
label variable rp_unsafe_home_sexor "Unsafe - at home; sexual orientation"

gen rp_unsafe_home_hlth = 2 if resunsafe5_11==1 & unsafe11==1
replace rp_unsafe_home_hlth = 1 if resunsafe5_11==0 & unsafe11==1
replace rp_unsafe_home_hlth =0 if unsafe11==0
replace rp_unsafe_home_hlth = -1 if unsafe11==-1
replace rp_unsafe_home_hlth = -8 if unsafe11==-8
label define rp_unsafe_home_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: at home" 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_home_hlth rp_unsafe_home_hlth
label variable rp_unsafe_home_hlth "Unsafe - at home; health and disability"

gen rp_unsafe_home_nat = 2 if resunsafe6_11==1 & unsafe11==1
replace rp_unsafe_home_nat = 1 if resunsafe6_11==0 & unsafe11==1
replace rp_unsafe_home_nat =0 if unsafe11==0
replace rp_unsafe_home_nat = -1 if unsafe11==-1
replace rp_unsafe_home_nat = -8 if unsafe11==-8
label define rp_unsafe_home_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: at home" 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_home_nat rp_unsafe_home_nat
label variable rp_unsafe_home_nat "Unsafe - at home; nationality"

gen rp_unsafe_home_rel = 2 if resunsafe7_11==1 & unsafe11==1
replace rp_unsafe_home_rel = 1 if resunsafe7_11==0 & unsafe11==1
replace rp_unsafe_home_rel =0 if unsafe11==0
replace rp_unsafe_home_rel = -1 if unsafe11==-1
replace rp_unsafe_home_rel = -8 if unsafe11==-8
label define rp_unsafe_home_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: at home" 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_home_rel rp_unsafe_home_rel
label variable rp_unsafe_home_rel "Unsafe - at home; religion"

gen rp_unsafe_home_lang = 2 if resunsafe8_11==1 & unsafe11==1
replace rp_unsafe_home_lang = 1 if resunsafe8_11==0 & unsafe11==1
replace rp_unsafe_home_lang =0 if unsafe11==0
replace rp_unsafe_home_lang = -1 if unsafe11==-1
replace rp_unsafe_home_lang = -8 if unsafe11==-8
label define rp_unsafe_home_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: at home" 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_home_lang rp_unsafe_home_lang
label variable rp_unsafe_home_lang "Unsafe - at home; language or accent"

gen rp_unsafe_home_drss = 2 if resunsafe9_11==1 & unsafe11==1
replace rp_unsafe_home_drss = 1 if resunsafe9_11==0 & unsafe11==1
replace rp_unsafe_home_drss =0 if unsafe11==0
replace rp_unsafe_home_drss = -1 if unsafe11==-1
replace rp_unsafe_home_drss = -8 if unsafe11==-8
label define rp_unsafe_home_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: at home" 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_home_drss rp_unsafe_home_drss
label variable rp_unsafe_home_drss "Unsafe - at home; appearance or dress"

gen rp_unsafe_home_oth = 2 if resunsafe96_11==1 & unsafe11==1
replace rp_unsafe_home_oth = 1 if resunsafe96_11==0 & unsafe11==1
replace rp_unsafe_home_oth =0 if unsafe11==0
replace rp_unsafe_home_oth = -1 if unsafe11==-1
replace rp_unsafe_home_oth = -8 if unsafe11==-8
label define rp_unsafe_home_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: at home" 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_home_oth rp_unsafe_home_oth
label variable rp_unsafe_home_oth "Unsafe - at home; 'other reason'"
replace rp_unsafe_home_oth = 2 if resunsafe97_11==1

* Other

gen rp_unsafe_other_sex = 2 if resunsafe1_12==1 & p_unsafe_other==1
replace rp_unsafe_other_sex = 1 if resunsafe1_12==0 & p_unsafe_other==1
replace rp_unsafe_other_sex =0 if p_unsafe_other==0
replace rp_unsafe_other_sex = -1 if p_unsafe_other==-1
replace rp_unsafe_other_sex = -8 if p_unsafe_other==-8
label define rp_unsafe_other_sex -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: other place" 1 "Unsafe: not sex" 2 "Unsafe: sex", modify
label values rp_unsafe_other_sex rp_unsafe_other_sex
label variable rp_unsafe_other_sex "Unsafe - other place; sex"

gen rp_unsafe_other_age = 2 if resunsafe2_12==1 & p_unsafe_other==1
replace rp_unsafe_other_age = 1 if resunsafe2_12==0 & p_unsafe_other==1
replace rp_unsafe_other_age =0 if p_unsafe_other==0
replace rp_unsafe_other_age = -1 if p_unsafe_other==-1
replace rp_unsafe_other_age = -8 if p_unsafe_other==-8
label define rp_unsafe_other_age -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: other place" 1 "Unsafe: not age" 2 "Unsafe: age", modify
label values rp_unsafe_other_age rp_unsafe_other_age
label variable rp_unsafe_other_age "Unsafe - other place; age"

gen rp_unsafe_other_eth = 2 if resunsafe3_12==1 & p_unsafe_other==1
replace rp_unsafe_other_eth = 1 if resunsafe3_12==0 & p_unsafe_other==1
replace rp_unsafe_other_eth =0 if p_unsafe_other==0
replace rp_unsafe_other_eth = -1 if p_unsafe_other==-1
replace rp_unsafe_other_eth = -8 if p_unsafe_other==-8
label define rp_unsafe_other_eth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: other place" 1 "Unsafe: not ethnicity" 2 "Unsafe: ethnicity", modify
label values rp_unsafe_other_eth rp_unsafe_other_eth
label variable rp_unsafe_other_eth "Unsafe - other place; ethnicity"

gen rp_unsafe_other_sexor = 2 if resunsafe4_12==1 & p_unsafe_other==1
replace rp_unsafe_other_sexor = 1 if resunsafe4_12==0 & p_unsafe_other==1
replace rp_unsafe_other_sexor =0 if p_unsafe_other==0
replace rp_unsafe_other_sexor = -1 if p_unsafe_other==-1
replace rp_unsafe_other_sexor = -8 if p_unsafe_other==-8
label define rp_unsafe_other_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: other place" 1 "Unsafe: not sexual orientation" 2 "Unsafe: sexual orientation", modify
label values rp_unsafe_other_sexor rp_unsafe_other_sexor
label variable rp_unsafe_other_sexor "Unsafe - other place; sexual orientation"

gen rp_unsafe_other_hlth = 2 if resunsafe5_12==1 & p_unsafe_other==1
replace rp_unsafe_other_hlth = 1 if resunsafe5_12==0 & p_unsafe_other==1
replace rp_unsafe_other_hlth =0 if p_unsafe_other==0
replace rp_unsafe_other_hlth = -1 if p_unsafe_other==-1
replace rp_unsafe_other_hlth = -8 if p_unsafe_other==-8
label define rp_unsafe_other_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: other place" 1 "Unsafe: not health and disability" 2 "Unsafe: health and disability", modify
label values rp_unsafe_other_hlth rp_unsafe_other_hlth
label variable rp_unsafe_other_hlth "Unsafe - other place; health and disability"

gen rp_unsafe_other_nat = 2 if resunsafe6_12==1 & p_unsafe_other==1
replace rp_unsafe_other_nat = 1 if resunsafe6_12==0 & p_unsafe_other==1
replace rp_unsafe_other_nat =0 if p_unsafe_other==0
replace rp_unsafe_other_nat = -1 if p_unsafe_other==-1
replace rp_unsafe_other_nat = -8 if p_unsafe_other==-8
label define rp_unsafe_other_nat -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: other place" 1 "Unsafe: not nationality" 2 "Unsafe: nationality", modify
label values rp_unsafe_other_nat rp_unsafe_other_nat
label variable rp_unsafe_other_nat "Unsafe - other place; nationality"

gen rp_unsafe_other_rel = 2 if resunsafe7_12==1 & p_unsafe_other==1
replace rp_unsafe_other_rel = 1 if resunsafe7_12==0 & p_unsafe_other==1
replace rp_unsafe_other_rel =0 if p_unsafe_other==0
replace rp_unsafe_other_rel = -1 if p_unsafe_other==-1
replace rp_unsafe_other_rel = -8 if p_unsafe_other==-8
label define rp_unsafe_other_rel -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: other place" 1 "Unsafe: not religion" 2 "Unsafe: religion", modify
label values rp_unsafe_other_rel rp_unsafe_other_rel
label variable rp_unsafe_other_rel "Unsafe - other place; religion"

gen rp_unsafe_other_lang = 2 if resunsafe8_12==1 & p_unsafe_other==1
replace rp_unsafe_other_lang = 1 if resunsafe8_12==0 & p_unsafe_other==1
replace rp_unsafe_other_lang =0 if p_unsafe_other==0
replace rp_unsafe_other_lang = -1 if p_unsafe_other==-1
replace rp_unsafe_other_lang = -8 if p_unsafe_other==-8
label define rp_unsafe_other_lang -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: other place" 1 "Unsafe: not language or accent" 2 "Unsafe: language or accent", modify
label values rp_unsafe_other_lang rp_unsafe_other_lang
label variable rp_unsafe_other_lang "Unsafe - other place; language or accent"

gen rp_unsafe_other_drss = 2 if resunsafe9_12==1 & p_unsafe_other==1
replace rp_unsafe_other_drss = 1 if resunsafe9_12==0 & p_unsafe_other==1
replace rp_unsafe_other_drss =0 if p_unsafe_other==0
replace rp_unsafe_other_drss = -1 if p_unsafe_other==-1
replace rp_unsafe_other_drss = -8 if p_unsafe_other==-8
label define rp_unsafe_other_drss -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: other place" 1 "Unsafe: not appearance or dress" 2 "Unsafe: appearance or dress", modify
label values rp_unsafe_other_drss rp_unsafe_other_drss
label variable rp_unsafe_other_drss "Unsafe - other place; appearance or dress"

gen rp_unsafe_other_oth = 2 if resunsafe96_12==1 & p_unsafe_other==1
replace rp_unsafe_other_oth = 1 if resunsafe96_12==0 & p_unsafe_other==1
replace rp_unsafe_other_oth =0 if p_unsafe_other==0
replace rp_unsafe_other_oth = -1 if p_unsafe_other==-1
replace rp_unsafe_other_oth = -8 if p_unsafe_other==-8
label define rp_unsafe_other_oth -8 "Inapplicable" -1 "Don't know" 0 "Not unsafe: other place" 1 "Unsafe: not 'other reason'" 2 "Unsafe: 'other reason'", modify
label values rp_unsafe_other_oth rp_unsafe_other_oth
label variable rp_unsafe_other_oth "Unsafe - other place; 'other reason'"
replace rp_unsafe_other_oth = 2 if resunsafe97_12==1

********************************************************************************

//v1
ge avoidance_anywhere=.
replace avoidance_anywhere=1 if avoidance96==0
replace avoidance_anywhere=0 if avoidance96==1
replace avoidance_anywhere=-8 if avoidance96==-8

lab var avoidance_anywhere "whether avoided any place"
lab define avoidance_anywhere_lab 0"no" 1"yes" -8"not applicable"
lab val avoidance_anywhere avoidance_anywhere_lab

//v2
ge avoidance_anywhere2=.
replace avoidance_anywhere2=1 if avoidance96==0
replace avoidance_anywhere2=0 if avoidance96==1

lab var avoidance_anywhere2 "whether avoided any place- no inapplicable"
lab val avoidance_anywhere2 avoidance_anywhere2_lab

***
*** Measures of WHERE people avoideded
***

clonevar p_avoid_schl = avoidance1
clonevar p_avoid_uni = avoidance2
clonevar p_avoid_wrk = avoidance3
clonevar p_avoid_ptran = avoidance4
clonevar p_avoid_btstn = avoidance5
clonevar p_avoid_shpc = avoidance6
clonevar p_avoid_cincf = avoidance7
clonevar p_avoid_nsoc = avoidance8
clonevar p_avoid_cpark = avoidance9
clonevar p_avoid_out = avoidance10
clonevar p_avoid_home = avoidance11
clonevar p_avoid_other = avoidance97
label variable p_avoid_schl "Place(s) avoided: School"
label variable p_avoid_uni "Place(s) avoided: College/University"
label variable p_avoid_wrk "Place(s) avoided: at work"
label variable p_avoid_ptran "Place(s) avoided: On public transport"
label variable p_avoid_btstn "Place(s) avoided: At/near Bus/train station"
label variable p_avoid_shpc "Place(s) avoided: In Shopping Centres, etc"
label variable p_avoid_cincf "Place(s) avoided: In cinema, cafes, etc."
label variable p_avoid_nsoc "Place(s) avoided: At pub/disco/club"
label variable p_avoid_cpark "Place(s) avoided: in car parks"
label variable p_avoid_out "Place(s) avoided: Outside, street/park"
label variable p_avoid_home "Place(s) avoided: at home"
label variable p_avoid_other "Place(s) avoided: Other Places"

* Recoding p_unsafe missings

recode p_avoid_schl- p_avoid_other (-9=.) (-7/-2=.)

* Recoding 'other places' into p_unsafe variables

replace p_avoid_schl = 1 if p_avoid_schl!=1 & avoidanceo_code==1
replace p_avoid_uni = 1 if p_avoid_uni!=1 & avoidanceo_code==2
replace p_avoid_wrk = 1 if p_avoid_wrk!=1 & avoidanceo_code==3
replace p_avoid_ptran = 1 if p_avoid_ptran!=1 & avoidanceo_code==4
replace p_avoid_btstn = 1 if p_avoid_btstn!=1 & avoidanceo_code==5
replace p_avoid_shpc = 1 if p_avoid_shpc!=1 & avoidanceo_code==6
replace p_avoid_cincf = 1 if p_avoid_cincf!=1 & avoidanceo_code==7
replace p_avoid_nsoc = 1 if p_avoid_nsoc!=1 & avoidanceo_code==8
replace p_avoid_cpark = 1 if p_avoid_cpark!=1 & avoidanceo_code==9
replace p_avoid_out = 1 if p_avoid_out!=1 & avoidanceo_code==10
replace p_avoid_home = 1 if p_avoid_home!=1 & avoidanceo_code==11

* Removing these 'substantive' options from the 'p_avoid_other' variable

replace p_avoid_other = 0 if unsafeo_code>2 & avoidanceo_code<12

***
*** Measures of WHY people avoided 
***

* Sex

gen r_avoid_sex = .
replace r_avoid_sex = 1 if resavoid1_1==1 | resavoid1_2==1 | resavoid1_3==1 | resavoid1_4==1 | resavoid1_5==1 | resavoid1_6==1 | resavoid1_7==1 | resavoid1_8==1 | resavoid1_9==1 | resavoid1_10==1 | resavoid1_11==1 | resavoid1_12==1
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_1==0
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_2==0
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_3==0
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_4==0
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_5==0
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_6==0
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_7==0
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_8==0
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_9==0
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_10==0
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_11==0
replace r_avoid_sex = 0 if r_avoid_sex!=1 & resavoid1_12==0

replace r_avoid_sex = 0 if (r_avoid_sex!=1 | r_avoid_sex!=0) & avoidance_anywhere==0
replace r_avoid_sex = -8 if (r_avoid_sex!=1 | r_avoid_sex!=0) & avoidance_anywhere==-8

label define r_ -8 "Inapplicable" 0 "No" 1 "Yes", modify
label values r_avoid_sex r_
label variable r_avoid_sex "Reason avoided: sex"

* Age

gen r_avoid_age = .
replace r_avoid_age = 1 if resavoid2_1==1 | resavoid2_2==1 | resavoid2_3==1 | resavoid2_4==1 | resavoid2_5==1 | resavoid2_6==1 | resavoid2_7==1 | resavoid2_8==1 | resavoid2_9==1 | resavoid2_10==1 | resavoid2_11==1 | resavoid2_12==1
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_1==0
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_2==0
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_3==0
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_4==0
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_5==0
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_6==0
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_7==0
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_8==0
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_9==0
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_10==0
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_11==0
replace r_avoid_age = 0 if r_avoid_age!=1 & resavoid2_12==0

replace r_avoid_age = 0 if (r_avoid_age!=1 | r_avoid_age!=0) & avoidance_anywhere==0
replace r_avoid_age = -8 if (r_avoid_age!=1 | r_avoid_age!=0) & avoidance_anywhere==-8

label values r_avoid_age r_
label variable r_avoid_age "Reason avoided: age"

* Ethnicity

gen r_avoid_eth = .
replace r_avoid_eth = 1 if resavoid3_1==1 | resavoid3_2==1 | resavoid3_3==1 | resavoid3_4==1 | resavoid3_5==1 | resavoid3_6==1 | resavoid3_7==1 | resavoid3_8==1 | resavoid3_9==1 | resavoid3_10==1 | resavoid3_11==1 | resavoid3_12==1
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_1==0
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_2==0
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_3==0
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_4==0
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_5==0
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_6==0
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_7==0
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_8==0
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_9==0
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_10==0
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_11==0
replace r_avoid_eth = 0 if r_avoid_eth!=1 & resavoid3_12==0

replace r_avoid_eth = 0 if (r_avoid_eth!=1 | r_avoid_eth!=0) & avoidance_anywhere==0
replace r_avoid_eth = -8 if (r_avoid_eth!=1 | r_avoid_eth!=0) & avoidance_anywhere==-8

label values r_avoid_eth r_
label variable r_avoid_eth "Reason avoided: ethnicity"

* Sexual Orientation

gen r_avoid_sexor = .
replace r_avoid_sexor = 1 if resavoid4_1==1 | resavoid4_2==1 | resavoid4_3==1 | resavoid4_4==1 | resavoid4_5==1 | resavoid4_6==1 | resavoid4_7==1 | resavoid4_8==1 | resavoid4_9==1 | resavoid4_10==1 | resavoid4_11==1 | resavoid4_12==1
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_1==0
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_2==0
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_3==0
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_4==0
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_5==0
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_6==0
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_7==0
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_8==0
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_9==0
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_10==0
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_11==0
replace r_avoid_sexor = 0 if r_avoid_sexor!=1 & resavoid4_12==0

replace r_avoid_sexor = 0 if (r_avoid_sexor!=1 | r_avoid_sexor!=0) & avoidance_anywhere==0
replace r_avoid_sexor = -8 if (r_avoid_sexor!=1 | r_avoid_sexor!=0) & avoidance_anywhere==-8

label values r_avoid_sexor r_
label variable r_avoid_sexor "Reason avoided: sexual orientation"

* Disability

gen r_avoid_hlth = .
replace r_avoid_hlth = 1 if resavoid5_1==1 | resavoid5_2==1 | resavoid5_3==1 | resavoid5_4==1 | resavoid5_5==1 | resavoid5_6==1 | resavoid5_7==1 | resavoid5_8==1 | resavoid5_9==1 | resavoid5_10==1 | resavoid5_11==1 | resavoid5_12==1
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_1==0
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_2==0
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_3==0
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_4==0
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_5==0
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_6==0
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_7==0
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_8==0
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_9==0
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_10==0
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_11==0
replace r_avoid_hlth = 0 if r_avoid_hlth!=1 & resavoid5_12==0

replace r_avoid_hlth = 0 if (r_avoid_hlth!=1 | r_avoid_hlth!=0) & avoidance_anywhere==0
replace r_avoid_hlth = -8 if (r_avoid_hlth!=1 | r_avoid_hlth!=0) & avoidance_anywhere==-8

label values r_avoid_hlth r_
label variable r_avoid_hlth "Reason avoided: health and disability"

* Nationality

gen r_avoid_nat = .
replace r_avoid_nat = 1 if resavoid6_1==1 | resavoid6_2==1 | resavoid6_3==1 | resavoid6_4==1 | resavoid6_5==1 | resavoid6_6==1 | resavoid6_7==1 | resavoid6_8==1 | resavoid6_9==1 | resavoid6_10==1 | resavoid6_11==1 | resavoid6_12==1
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_1==0
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_2==0
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_3==0
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_4==0
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_5==0
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_6==0
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_7==0
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_8==0
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_9==0
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_10==0
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_11==0
replace r_avoid_nat = 0 if r_avoid_nat!=1 & resavoid6_12==0

replace r_avoid_nat = 0 if (r_avoid_nat!=1 | r_avoid_nat!=0) & avoidance_anywhere==0
replace r_avoid_nat = -8 if (r_avoid_nat!=1 | r_avoid_nat!=0) & avoidance_anywhere==-8

label values r_avoid_nat r_
label variable r_avoid_nat "Reason avoided: nationality"

* Religion

gen r_avoid_rel = .
replace r_avoid_rel = 1 if resavoid7_1==1 | resavoid7_2==1 | resavoid7_3==1 | resavoid7_4==1 | resavoid7_5==1 | resavoid7_6==1 | resavoid7_7==1 | resavoid7_8==1 | resavoid7_9==1 | resavoid7_10==1 | resavoid7_11==1 | resavoid7_12==1
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_1==0
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_2==0
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_3==0
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_4==0
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_5==0
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_6==0
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_7==0
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_8==0
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_9==0
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_10==0
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_11==0
replace r_avoid_rel = 0 if r_avoid_rel!=1 & resavoid7_12==0

replace r_avoid_rel = 0 if (r_avoid_rel!=1 | r_avoid_rel!=0) & avoidance_anywhere==0
replace r_avoid_rel = -8 if (r_avoid_rel!=1 | r_avoid_rel!=0) & avoidance_anywhere==-8

label values r_avoid_rel r_
label variable r_avoid_rel "Reason avoided: religion"

* Language/Accent

gen r_avoid_lang = .
replace r_avoid_lang = 1 if resavoid8_1==1 | resavoid8_2==1 | resavoid8_3==1 | resavoid8_4==1 | resavoid8_5==1 | resavoid8_6==1 | resavoid8_7==1 | resavoid8_8==1 | resavoid8_9==1 | resavoid8_10==1 | resavoid8_11==1 | resavoid8_12==1
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_1==0
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_2==0
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_3==0
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_4==0
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_5==0
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_6==0
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_7==0
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_8==0
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_9==0
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_10==0
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_11==0
replace r_avoid_lang = 0 if r_avoid_lang!=1 & resavoid8_12==0

replace r_avoid_lang = 0 if (r_avoid_lang!=1 | r_avoid_lang!=0) & avoidance_anywhere==0
replace r_avoid_lang = -8 if (r_avoid_lang!=1 | r_avoid_lang!=0) & avoidance_anywhere==-8

label values r_avoid_lang r_
label variable r_avoid_lang "Reason avoided: language or accent"

* Language/Accent

gen r_avoid_drss = .
replace r_avoid_drss = 1 if resavoid9_1==1 | resavoid9_2==1 | resavoid9_3==1 | resavoid9_4==1 | resavoid9_5==1 | resavoid9_6==1 | resavoid9_7==1 | resavoid9_8==1 | resavoid9_9==1 | resavoid9_10==1 | resavoid9_11==1 | resavoid9_12==1
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_1==0
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_2==0
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_3==0
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_4==0
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_5==0
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_6==0
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_7==0
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_8==0
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_9==0
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_10==0
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_11==0
replace r_avoid_drss = 0 if r_avoid_drss!=1 & resavoid9_12==0

replace r_avoid_drss = 0 if (r_avoid_drss!=1 | r_avoid_drss!=0) & avoidance_anywhere==0
replace r_avoid_drss = -8 if (r_avoid_drss!=1 | r_avoid_drss!=0) & avoidance_anywhere==-8

label values r_avoid_drss r_
label variable r_avoid_drss "Reason avoided: appearance or dress"

* Other reason/none of the above

gen r_avoid_other = .
replace r_avoid_other = 1 if resavoid96_1==1 | resavoid96_2==1 | resavoid96_3==1 | resavoid96_4==1 | resavoid96_5==1 | resavoid96_6==1 | resavoid96_7==1 | resavoid96_8==1 | resavoid96_9==1 | resavoid96_10==1 | resavoid96_11==1 | resavoid96_12==1
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_1==0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_2==0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_3==0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_4==0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_5==0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_6==0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_7==0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_8==0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_9==0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_10==0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_11==0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid96_12==0

replace r_avoid_other = 0 if (r_avoid_other!=1 | r_avoid_other!=0) & avoidance_anywhere==0
replace r_avoid_other = -8 if (r_avoid_other!=1 | r_avoid_other!=0) & avoidance_anywhere==-8

label values r_avoid_other r_
label variable r_avoid_other "Reason avoided: other reason/none of the above"

replace r_avoid_other = 1 if (resavoid97_1==1 | resavoid97_2==1 | resavoid97_3==1 | resavoid97_4==1 | resavoid97_5==1 | resavoid97_6==1 | resavoid97_7==1 | resavoid97_8==1 | resavoid97_9==1 | resavoid97_10==1 | resavoid97_11==1 | resavoid97_12==1) & r_avoid_other!=1
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_1==0 & r_avoid_other!=0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_2==0 & r_avoid_other!=0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_3==0 & r_avoid_other!=0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_4==0 & r_avoid_other!=0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_5==0 & r_avoid_other!=0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_6==0 & r_avoid_other!=0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_7==0 & r_avoid_other!=0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_8==0 & r_avoid_other!=0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_9==0 & r_avoid_other!=0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_10==0 & r_avoid_other!=0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_11==0 & r_avoid_other!=0
replace r_avoid_other = 0 if r_avoid_other!=1 & resavoid97_12==0 & r_avoid_other!=0

***
*** Measures of WHY people AVOIDED particular places
***

* SCHOOL

gen rp_avoid_schl_sex = 2 if resavoid1_1==1 & avoidance1==1
replace rp_avoid_schl_sex = 1 if resavoid1_1==0 & avoidance1==1
replace rp_avoid_schl_sex =0 if avoidance1==0
replace rp_avoid_schl_sex = -1 if avoidance1==-1
replace rp_avoid_schl_sex = -8 if avoidance1==-8
label define rp_avoid_schl_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: school" 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_schl_sex rp_avoid_schl_sex
label variable rp_avoid_schl_sex "avoid - school; sex"

gen rp_avoid_schl_age = 2 if resavoid2_1==1 & avoidance1==1
replace rp_avoid_schl_age = 1 if resavoid2_1==0 & avoidance1==1
replace rp_avoid_schl_age =0 if avoidance1==0
replace rp_avoid_schl_age = -1 if avoidance1==-1
replace rp_avoid_schl_age = -8 if avoidance1==-8
label define rp_avoid_schl_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: school" 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_schl_age rp_avoid_schl_age
label variable rp_avoid_schl_age "avoid - school; age"

gen rp_avoid_schl_eth = 2 if resavoid3_1==1 & avoidance1==1
replace rp_avoid_schl_eth = 1 if resavoid3_1==0 & avoidance1==1
replace rp_avoid_schl_eth =0 if avoidance1==0
replace rp_avoid_schl_eth = -1 if avoidance1==-1
replace rp_avoid_schl_eth = -8 if avoidance1==-8
label define rp_avoid_schl_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: school" 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_schl_eth rp_avoid_schl_eth
label variable rp_avoid_schl_eth "avoid - school; ethnicity"

gen rp_avoid_schl_sexor = 2 if resavoid4_1==1 & avoidance1==1
replace rp_avoid_schl_sexor = 1 if resavoid4_1==0 & avoidance1==1
replace rp_avoid_schl_sexor =0 if avoidance1==0
replace rp_avoid_schl_sexor = -1 if avoidance1==-1
replace rp_avoid_schl_sexor = -8 if avoidance1==-8
label define rp_avoid_schl_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: school" 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_schl_sexor rp_avoid_schl_sexor
label variable rp_avoid_schl_sexor "avoid - school; sexual orientation"

gen rp_avoid_schl_hlth = 2 if resavoid5_1==1 & avoidance1==1
replace rp_avoid_schl_hlth = 1 if resavoid5_1==0 & avoidance1==1
replace rp_avoid_schl_hlth =0 if avoidance1==0
replace rp_avoid_schl_hlth = -1 if avoidance1==-1
replace rp_avoid_schl_hlth = -8 if avoidance1==-8
label define rp_avoid_schl_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: school" 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_schl_hlth rp_avoid_schl_hlth
label variable rp_avoid_schl_hlth "avoid - school; health and disability"

gen rp_avoid_schl_nat = 2 if resavoid6_1==1 & avoidance1==1
replace rp_avoid_schl_nat = 1 if resavoid6_1==0 & avoidance1==1
replace rp_avoid_schl_nat =0 if avoidance1==0
replace rp_avoid_schl_nat = -1 if avoidance1==-1
replace rp_avoid_schl_nat = -8 if avoidance1==-8
label define rp_avoid_schl_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: school" 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_schl_nat rp_avoid_schl_nat
label variable rp_avoid_schl_nat "avoid - school; nationality"

gen rp_avoid_schl_rel = 2 if resavoid7_1==1 & avoidance1==1
replace rp_avoid_schl_rel = 1 if resavoid7_1==0 & avoidance1==1
replace rp_avoid_schl_rel =0 if avoidance1==0
replace rp_avoid_schl_rel = -1 if avoidance1==-1
replace rp_avoid_schl_rel = -8 if avoidance1==-8
label define rp_avoid_schl_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: school" 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_schl_rel rp_avoid_schl_rel
label variable rp_avoid_schl_rel "avoid - school; religion"

gen rp_avoid_schl_lang = 2 if resavoid8_1==1 & avoidance1==1
replace rp_avoid_schl_lang = 1 if resavoid8_1==0 & avoidance1==1
replace rp_avoid_schl_lang =0 if avoidance1==0
replace rp_avoid_schl_lang = -1 if avoidance1==-1
replace rp_avoid_schl_lang = -8 if avoidance1==-8
label define rp_avoid_schl_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: school" 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_schl_lang rp_avoid_schl_lang
label variable rp_avoid_schl_lang "avoid - school; language or accent"

gen rp_avoid_schl_drss = 2 if resavoid9_1==1 & avoidance1==1
replace rp_avoid_schl_drss = 1 if resavoid9_1==0 & avoidance1==1
replace rp_avoid_schl_drss =0 if avoidance1==0
replace rp_avoid_schl_drss = -1 if avoidance1==-1
replace rp_avoid_schl_drss = -8 if avoidance1==-8
label define rp_avoid_schl_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: school" 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_schl_drss rp_avoid_schl_drss
label variable rp_avoid_schl_drss "avoid - school; appearance or dress"

gen rp_avoid_schl_oth = 2 if resavoid96_1==1 & avoidance1==1
replace rp_avoid_schl_oth = 1 if resavoid96_1==0 & avoidance1==1
replace rp_avoid_schl_oth =0 if avoidance1==0
replace rp_avoid_schl_oth = -1 if avoidance1==-1
replace rp_avoid_schl_oth = -8 if avoidance1==-8
label define rp_avoid_schl_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: school" 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_schl_oth rp_avoid_schl_oth
label variable rp_avoid_schl_oth "avoid - school; 'other reason'"
replace rp_avoid_schl_oth = 2 if resavoid97_1==1

* In college/uni

gen rp_avoid_uni_sex = 2 if resavoid1_2==1 & avoidance2==1
replace rp_avoid_uni_sex = 1 if resavoid1_2==0 & avoidance2==1
replace rp_avoid_uni_sex =0 if avoidance2==0
replace rp_avoid_uni_sex = -1 if avoidance2==-1
replace rp_avoid_uni_sex = -8 if avoidance2==-8
label define rp_avoid_uni_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: college/uni" 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_uni_sex rp_avoid_uni_sex
label variable rp_avoid_uni_sex "avoid - college/uni; sex"

gen rp_avoid_uni_age = 2 if resavoid2_2==1 & avoidance2==1
replace rp_avoid_uni_age = 1 if resavoid2_2==0 & avoidance2==1
replace rp_avoid_uni_age =0 if avoidance2==0
replace rp_avoid_uni_age = -1 if avoidance2==-1
replace rp_avoid_uni_age = -8 if avoidance2==-8
label define rp_avoid_uni_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: college/uni" 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_uni_age rp_avoid_uni_age
label variable rp_avoid_uni_age "avoid - college/uni; age"

gen rp_avoid_uni_eth = 2 if resavoid3_2==1 & avoidance2==1
replace rp_avoid_uni_eth = 1 if resavoid3_2==0 & avoidance2==1
replace rp_avoid_uni_eth =0 if avoidance2==0
replace rp_avoid_uni_eth = -1 if avoidance2==-1
replace rp_avoid_uni_eth = -8 if avoidance2==-8
label define rp_avoid_uni_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: college/uni" 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_uni_eth rp_avoid_uni_eth
label variable rp_avoid_uni_eth "avoid - college/uni; ethnicity"

gen rp_avoid_uni_sexor = 2 if resavoid4_2==1 & avoidance2==1
replace rp_avoid_uni_sexor = 1 if resavoid4_2==0 & avoidance2==1
replace rp_avoid_uni_sexor =0 if avoidance2==0
replace rp_avoid_uni_sexor = -1 if avoidance2==-1
replace rp_avoid_uni_sexor = -8 if avoidance2==-8
label define rp_avoid_uni_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: college/uni" 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_uni_sexor rp_avoid_uni_sexor
label variable rp_avoid_uni_sexor "avoid - college/uni; sexual orientation"

gen rp_avoid_uni_hlth = 2 if resavoid5_2==1 & avoidance2==1
replace rp_avoid_uni_hlth = 1 if resavoid5_2==0 & avoidance2==1
replace rp_avoid_uni_hlth =0 if avoidance2==0
replace rp_avoid_uni_hlth = -1 if avoidance2==-1
replace rp_avoid_uni_hlth = -8 if avoidance2==-8
label define rp_avoid_uni_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: college/uni" 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_uni_hlth rp_avoid_uni_hlth
label variable rp_avoid_uni_hlth "avoid - college/uni; health and disability"

gen rp_avoid_uni_nat = 2 if resavoid6_2==1 & avoidance2==1
replace rp_avoid_uni_nat = 1 if resavoid6_2==0 & avoidance2==1
replace rp_avoid_uni_nat =0 if avoidance2==0
replace rp_avoid_uni_nat = -1 if avoidance2==-1
replace rp_avoid_uni_nat = -8 if avoidance2==-8
label define rp_avoid_uni_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: college/uni" 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_uni_nat rp_avoid_uni_nat
label variable rp_avoid_uni_nat "avoid - college/uni; nationality"

gen rp_avoid_uni_rel = 2 if resavoid7_2==1 & avoidance2==1
replace rp_avoid_uni_rel = 1 if resavoid7_2==0 & avoidance2==1
replace rp_avoid_uni_rel =0 if avoidance2==0
replace rp_avoid_uni_rel = -1 if avoidance2==-1
replace rp_avoid_uni_rel = -8 if avoidance2==-8
label define rp_avoid_uni_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: college/uni" 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_uni_rel rp_avoid_uni_rel
label variable rp_avoid_uni_rel "avoid - college/uni; religion"

gen rp_avoid_uni_lang = 2 if resavoid8_2==1 & avoidance2==1
replace rp_avoid_uni_lang = 1 if resavoid8_2==0 & avoidance2==1
replace rp_avoid_uni_lang =0 if avoidance2==0
replace rp_avoid_uni_lang = -1 if avoidance2==-1
replace rp_avoid_uni_lang = -8 if avoidance2==-8
label define rp_avoid_uni_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: college/uni" 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_uni_lang rp_avoid_uni_lang
label variable rp_avoid_uni_lang "avoid - college/uni; language or accent"

gen rp_avoid_uni_drss = 2 if resavoid9_2==1 & avoidance2==1
replace rp_avoid_uni_drss = 1 if resavoid9_2==0 & avoidance2==1
replace rp_avoid_uni_drss =0 if avoidance2==0
replace rp_avoid_uni_drss = -1 if avoidance2==-1
replace rp_avoid_uni_drss = -8 if avoidance2==-8
label define rp_avoid_uni_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: college/uni" 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_uni_drss rp_avoid_uni_drss
label variable rp_avoid_uni_drss "avoid - college/uni; appearance or dress"

gen rp_avoid_uni_oth = 2 if resavoid96_2==1 & avoidance2==1
replace rp_avoid_uni_oth = 1 if resavoid96_2==0 & avoidance2==1
replace rp_avoid_uni_oth =0 if avoidance2==0
replace rp_avoid_uni_oth = -1 if avoidance2==-1
replace rp_avoid_uni_oth = -8 if avoidance2==-8
label define rp_avoid_uni_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: college/uni" 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_uni_oth rp_avoid_uni_oth
label variable rp_avoid_uni_oth "avoid - college/uni; 'other reason'"
replace rp_avoid_uni_oth = 2 if resavoid97_2==1

* Work

gen rp_avoid_wrk_sex = 2 if resavoid1_3==1 & avoidance3==1
replace rp_avoid_wrk_sex = 1 if resavoid1_3==0 & avoidance3==1
replace rp_avoid_wrk_sex =0 if avoidance3==0
replace rp_avoid_wrk_sex = -1 if avoidance3==-1
replace rp_avoid_wrk_sex = -8 if avoidance3==-8
label define rp_avoid_wrk_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: work" 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_wrk_sex rp_avoid_wrk_sex
label variable rp_avoid_wrk_sex "avoid - work; sex"

gen rp_avoid_wrk_age = 2 if resavoid2_3==1 & avoidance3==1
replace rp_avoid_wrk_age = 1 if resavoid2_3==0 & avoidance3==1
replace rp_avoid_wrk_age =0 if avoidance3==0
replace rp_avoid_wrk_age = -1 if avoidance3==-1
replace rp_avoid_wrk_age = -8 if avoidance3==-8
label define rp_avoid_wrk_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: work" 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_wrk_age rp_avoid_wrk_age
label variable rp_avoid_wrk_age "avoid - work; age"

gen rp_avoid_wrk_eth = 2 if resavoid3_3==1 & avoidance3==1
replace rp_avoid_wrk_eth = 1 if resavoid3_3==0 & avoidance3==1
replace rp_avoid_wrk_eth =0 if avoidance3==0
replace rp_avoid_wrk_eth = -1 if avoidance3==-1
replace rp_avoid_wrk_eth = -8 if avoidance3==-8
label define rp_avoid_wrk_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: work" 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_wrk_eth rp_avoid_wrk_eth
label variable rp_avoid_wrk_eth "avoid - work; ethnicity"

gen rp_avoid_wrk_sexor = 2 if resavoid4_3==1 & avoidance3==1
replace rp_avoid_wrk_sexor = 1 if resavoid4_3==0 & avoidance3==1
replace rp_avoid_wrk_sexor =0 if avoidance3==0
replace rp_avoid_wrk_sexor = -1 if avoidance3==-1
replace rp_avoid_wrk_sexor = -8 if avoidance3==-8
label define rp_avoid_wrk_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: work" 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_wrk_sexor rp_avoid_wrk_sexor
label variable rp_avoid_wrk_sexor "avoid - work; sexual orientation"

gen rp_avoid_wrk_hlth = 2 if resavoid5_3==1 & avoidance3==1
replace rp_avoid_wrk_hlth = 1 if resavoid5_3==0 & avoidance3==1
replace rp_avoid_wrk_hlth =0 if avoidance3==0
replace rp_avoid_wrk_hlth = -1 if avoidance3==-1
replace rp_avoid_wrk_hlth = -8 if avoidance3==-8
label define rp_avoid_wrk_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: work" 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_wrk_hlth rp_avoid_wrk_hlth
label variable rp_avoid_wrk_hlth "avoid - work; health and disability"

gen rp_avoid_wrk_nat = 2 if resavoid6_3==1 & avoidance3==1
replace rp_avoid_wrk_nat = 1 if resavoid6_3==0 & avoidance3==1
replace rp_avoid_wrk_nat =0 if avoidance3==0
replace rp_avoid_wrk_nat = -1 if avoidance3==-1
replace rp_avoid_wrk_nat = -8 if avoidance3==-8
label define rp_avoid_wrk_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: work" 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_wrk_nat rp_avoid_wrk_nat
label variable rp_avoid_wrk_nat "avoid - work; nationality"

gen rp_avoid_wrk_rel = 2 if resavoid7_3==1 & avoidance3==1
replace rp_avoid_wrk_rel = 1 if resavoid7_3==0 & avoidance3==1
replace rp_avoid_wrk_rel =0 if avoidance3==0
replace rp_avoid_wrk_rel = -1 if avoidance3==-1
replace rp_avoid_wrk_rel = -8 if avoidance3==-8
label define rp_avoid_wrk_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: work" 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_wrk_rel rp_avoid_wrk_rel
label variable rp_avoid_wrk_rel "avoid - work; religion"

gen rp_avoid_wrk_lang = 2 if resavoid8_3==1 & avoidance3==1
replace rp_avoid_wrk_lang = 1 if resavoid8_3==0 & avoidance3==1
replace rp_avoid_wrk_lang =0 if avoidance3==0
replace rp_avoid_wrk_lang = -1 if avoidance3==-1
replace rp_avoid_wrk_lang = -8 if avoidance3==-8
label define rp_avoid_wrk_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: work" 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_wrk_lang rp_avoid_wrk_lang
label variable rp_avoid_wrk_lang "avoid - work; language or accent"

gen rp_avoid_wrk_drss = 2 if resavoid9_3==1 & avoidance3==1
replace rp_avoid_wrk_drss = 1 if resavoid9_3==0 & avoidance3==1
replace rp_avoid_wrk_drss =0 if avoidance3==0
replace rp_avoid_wrk_drss = -1 if avoidance3==-1
replace rp_avoid_wrk_drss = -8 if avoidance3==-8
label define rp_avoid_wrk_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: work" 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_wrk_drss rp_avoid_wrk_drss
label variable rp_avoid_wrk_drss "avoid - work; appearance or dress"

gen rp_avoid_wrk_oth = 2 if resavoid96_3==1 & avoidance3==1
replace rp_avoid_wrk_oth = 1 if resavoid96_3==0 & avoidance3==1
replace rp_avoid_wrk_oth =0 if avoidance3==0
replace rp_avoid_wrk_oth = -1 if avoidance3==-1
replace rp_avoid_wrk_oth = -8 if avoidance3==-8
label define rp_avoid_wrk_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: work" 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_wrk_oth rp_avoid_wrk_oth
label variable rp_avoid_wrk_oth "avoid - work; 'other reason'"
replace rp_avoid_wrk_oth = 2 if resavoid97_3==1

* Public Transportation

gen rp_avoid_ptran_sex = 2 if resavoid1_4==1 & avoidance4==1
replace rp_avoid_ptran_sex = 1 if resavoid1_4==0 & avoidance4==1
replace rp_avoid_ptran_sex =0 if avoidance4==0
replace rp_avoid_ptran_sex = -1 if avoidance4==-1
replace rp_avoid_ptran_sex = -8 if avoidance4==-8
label define rp_avoid_ptran_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pub. trans." 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_ptran_sex rp_avoid_ptran_sex
label variable rp_avoid_ptran_sex "avoid - public transportation; sex"

gen rp_avoid_ptran_age = 2 if resavoid2_4==1 & avoidance4==1
replace rp_avoid_ptran_age = 1 if resavoid2_4==0 & avoidance4==1
replace rp_avoid_ptran_age =0 if avoidance4==0
replace rp_avoid_ptran_age = -1 if avoidance4==-1
replace rp_avoid_ptran_age = -8 if avoidance4==-8
label define rp_avoid_ptran_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pub. trans." 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_ptran_age rp_avoid_ptran_age
label variable rp_avoid_ptran_age "avoid - public transportation; age"

gen rp_avoid_ptran_eth = 2 if resavoid3_4==1 & avoidance4==1
replace rp_avoid_ptran_eth = 1 if resavoid3_4==0 & avoidance4==1
replace rp_avoid_ptran_eth =0 if avoidance4==0
replace rp_avoid_ptran_eth = -1 if avoidance4==-1
replace rp_avoid_ptran_eth = -8 if avoidance4==-8
label define rp_avoid_ptran_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pub. trans." 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_ptran_eth rp_avoid_ptran_eth
label variable rp_avoid_ptran_eth "avoid - public transportation; ethnicity"

gen rp_avoid_ptran_sexor = 2 if resavoid4_4==1 & avoidance4==1
replace rp_avoid_ptran_sexor = 1 if resavoid4_4==0 & avoidance4==1
replace rp_avoid_ptran_sexor =0 if avoidance4==0
replace rp_avoid_ptran_sexor = -1 if avoidance4==-1
replace rp_avoid_ptran_sexor = -8 if avoidance4==-8
label define rp_avoid_ptran_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pub. trans." 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_ptran_sexor rp_avoid_ptran_sexor
label variable rp_avoid_ptran_sexor "avoid - public transportation; sexual orientation"

gen rp_avoid_ptran_hlth = 2 if resavoid5_4==1 & avoidance4==1
replace rp_avoid_ptran_hlth = 1 if resavoid5_4==0 & avoidance4==1
replace rp_avoid_ptran_hlth =0 if avoidance4==0
replace rp_avoid_ptran_hlth = -1 if avoidance4==-1
replace rp_avoid_ptran_hlth = -8 if avoidance4==-8
label define rp_avoid_ptran_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pub. trans." 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_ptran_hlth rp_avoid_ptran_hlth
label variable rp_avoid_ptran_hlth "avoid - public transportation; health and disability"

gen rp_avoid_ptran_nat = 2 if resavoid6_4==1 & avoidance4==1
replace rp_avoid_ptran_nat = 1 if resavoid6_4==0 & avoidance4==1
replace rp_avoid_ptran_nat =0 if avoidance4==0
replace rp_avoid_ptran_nat = -1 if avoidance4==-1
replace rp_avoid_ptran_nat = -8 if avoidance4==-8
label define rp_avoid_ptran_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pub. trans." 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_ptran_nat rp_avoid_ptran_nat
label variable rp_avoid_ptran_nat "avoid - public transportation; nationality"

gen rp_avoid_ptran_rel = 2 if resavoid7_4==1 & avoidance4==1
replace rp_avoid_ptran_rel = 1 if resavoid7_4==0 & avoidance4==1
replace rp_avoid_ptran_rel =0 if avoidance4==0
replace rp_avoid_ptran_rel = -1 if avoidance4==-1
replace rp_avoid_ptran_rel = -8 if avoidance4==-8
label define rp_avoid_ptran_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pub. trans." 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_ptran_rel rp_avoid_ptran_rel
label variable rp_avoid_ptran_rel "avoid - public transportation; religion"

gen rp_avoid_ptran_lang = 2 if resavoid8_4==1 & avoidance4==1
replace rp_avoid_ptran_lang = 1 if resavoid8_4==0 & avoidance4==1
replace rp_avoid_ptran_lang =0 if avoidance4==0
replace rp_avoid_ptran_lang = -1 if avoidance4==-1
replace rp_avoid_ptran_lang = -8 if avoidance4==-8
label define rp_avoid_ptran_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pub. trans." 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_ptran_lang rp_avoid_ptran_lang
label variable rp_avoid_ptran_lang "avoid - public transportation; language or accent"

gen rp_avoid_ptran_drss = 2 if resavoid9_4==1 & avoidance4==1
replace rp_avoid_ptran_drss = 1 if resavoid9_4==0 & avoidance4==1
replace rp_avoid_ptran_drss =0 if avoidance4==0
replace rp_avoid_ptran_drss = -1 if avoidance4==-1
replace rp_avoid_ptran_drss = -8 if avoidance4==-8
label define rp_avoid_ptran_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pub. trans." 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_ptran_drss rp_avoid_ptran_drss
label variable rp_avoid_ptran_drss "avoid - public transportation; appearance or dress"

gen rp_avoid_ptran_oth = 2 if resavoid96_4==1 & avoidance4==1
replace rp_avoid_ptran_oth = 1 if resavoid96_4==0 & avoidance4==1
replace rp_avoid_ptran_oth =0 if avoidance4==0
replace rp_avoid_ptran_oth = -1 if avoidance4==-1
replace rp_avoid_ptran_oth = -8 if avoidance4==-8
label define rp_avoid_ptran_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pub. trans." 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_ptran_oth rp_avoid_ptran_oth
label variable rp_avoid_ptran_oth "avoid - public transportation	; 'other reason'"
replace rp_avoid_ptran_oth = 2 if resavoid97_4==1

* Bus/Train Station

gen rp_avoid_btstn_sex = 2 if resavoid1_5==1 & avoidance5==1
replace rp_avoid_btstn_sex = 1 if resavoid1_5==0 & avoidance5==1
replace rp_avoid_btstn_sex =0 if avoidance5==0
replace rp_avoid_btstn_sex = -1 if avoidance5==-1
replace rp_avoid_btstn_sex = -8 if avoidance5==-8
label define rp_avoid_btstn_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: stations" 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_btstn_sex rp_avoid_btstn_sex
label variable rp_avoid_btstn_sex "avoid - bus/train stations; sex"

gen rp_avoid_btstn_age = 2 if resavoid2_5==1 & avoidance5==1
replace rp_avoid_btstn_age = 1 if resavoid2_5==0 & avoidance5==1
replace rp_avoid_btstn_age =0 if avoidance5==0
replace rp_avoid_btstn_age = -1 if avoidance5==-1
replace rp_avoid_btstn_age = -8 if avoidance5==-8
label define rp_avoid_btstn_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: stations" 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_btstn_age rp_avoid_btstn_age
label variable rp_avoid_btstn_age "avoid - bus/train stations; age"

gen rp_avoid_btstn_eth = 2 if resavoid3_5==1 & avoidance5==1
replace rp_avoid_btstn_eth = 1 if resavoid3_5==0 & avoidance5==1
replace rp_avoid_btstn_eth =0 if avoidance5==0
replace rp_avoid_btstn_eth = -1 if avoidance5==-1
replace rp_avoid_btstn_eth = -8 if avoidance5==-8
label define rp_avoid_btstn_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: stations" 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_btstn_eth rp_avoid_btstn_eth
label variable rp_avoid_btstn_eth "avoid - bus/train stations; ethnicity"

gen rp_avoid_btstn_sexor = 2 if resavoid4_5==1 & avoidance5==1
replace rp_avoid_btstn_sexor = 1 if resavoid4_5==0 & avoidance5==1
replace rp_avoid_btstn_sexor =0 if avoidance5==0
replace rp_avoid_btstn_sexor = -1 if avoidance5==-1
replace rp_avoid_btstn_sexor = -8 if avoidance5==-8
label define rp_avoid_btstn_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: stations" 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_btstn_sexor rp_avoid_btstn_sexor
label variable rp_avoid_btstn_sexor "avoid - bus/train stations; sexual orientation"

gen rp_avoid_btstn_hlth = 2 if resavoid5_5==1 & avoidance5==1
replace rp_avoid_btstn_hlth = 1 if resavoid5_5==0 & avoidance5==1
replace rp_avoid_btstn_hlth =0 if avoidance5==0
replace rp_avoid_btstn_hlth = -1 if avoidance5==-1
replace rp_avoid_btstn_hlth = -8 if avoidance5==-8
label define rp_avoid_btstn_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: stations" 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_btstn_hlth rp_avoid_btstn_hlth
label variable rp_avoid_btstn_hlth "avoid - bus/train stations; health and disability"

gen rp_avoid_btstn_nat = 2 if resavoid6_5==1 & avoidance5==1
replace rp_avoid_btstn_nat = 1 if resavoid6_5==0 & avoidance5==1
replace rp_avoid_btstn_nat =0 if avoidance5==0
replace rp_avoid_btstn_nat = -1 if avoidance5==-1
replace rp_avoid_btstn_nat = -8 if avoidance5==-8
label define rp_avoid_btstn_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: stations" 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_btstn_nat rp_avoid_btstn_nat
label variable rp_avoid_btstn_nat "avoid - bus/train stations; nationality"

gen rp_avoid_btstn_rel = 2 if resavoid7_5==1 & avoidance5==1
replace rp_avoid_btstn_rel = 1 if resavoid7_5==0 & avoidance5==1
replace rp_avoid_btstn_rel =0 if avoidance5==0
replace rp_avoid_btstn_rel = -1 if avoidance5==-1
replace rp_avoid_btstn_rel = -8 if avoidance5==-8
label define rp_avoid_btstn_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: stations" 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_btstn_rel rp_avoid_btstn_rel
label variable rp_avoid_btstn_rel "avoid - bus/train stations; religion"

gen rp_avoid_btstn_lang = 2 if resavoid8_5==1 & avoidance5==1
replace rp_avoid_btstn_lang = 1 if resavoid8_5==0 & avoidance5==1
replace rp_avoid_btstn_lang =0 if avoidance5==0
replace rp_avoid_btstn_lang = -1 if avoidance5==-1
replace rp_avoid_btstn_lang = -8 if avoidance5==-8
label define rp_avoid_btstn_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: stations" 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_btstn_lang rp_avoid_btstn_lang
label variable rp_avoid_btstn_lang "avoid - bus/train stations; language or accent"

gen rp_avoid_btstn_drss = 2 if resavoid9_5==1 & avoidance5==1
replace rp_avoid_btstn_drss = 1 if resavoid9_5==0 & avoidance5==1
replace rp_avoid_btstn_drss =0 if avoidance5==0
replace rp_avoid_btstn_drss = -1 if avoidance5==-1
replace rp_avoid_btstn_drss = -8 if avoidance5==-8
label define rp_avoid_btstn_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: stations" 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_btstn_drss rp_avoid_btstn_drss
label variable rp_avoid_btstn_drss "avoid - bus/train stations; appearance or dress"

gen rp_avoid_btstn_oth = 2 if resavoid96_5==1 & avoidance5==1
replace rp_avoid_btstn_oth = 1 if resavoid96_5==0 & avoidance5==1
replace rp_avoid_btstn_oth =0 if avoidance5==0
replace rp_avoid_btstn_oth = -1 if avoidance5==-1
replace rp_avoid_btstn_oth = -8 if avoidance5==-8
label define rp_avoid_btstn_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: stations" 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_btstn_oth rp_avoid_btstn_oth
label variable rp_avoid_btstn_oth "avoid - bus/train stations; 'other reason'"
replace rp_avoid_btstn_oth = 2 if resavoid97_5==1

* Shopping centres

gen rp_avoid_shpc_sex = 2 if resavoid1_6==1 & avoidance6==1
replace rp_avoid_shpc_sex = 1 if resavoid1_6==0 & avoidance6==1
replace rp_avoid_shpc_sex =0 if avoidance6==0
replace rp_avoid_shpc_sex = -1 if avoidance6==-1
replace rp_avoid_shpc_sex = -8 if avoidance6==-8
label define rp_avoid_shpc_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: shopping, etc." 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_shpc_sex rp_avoid_shpc_sex
label variable rp_avoid_shpc_sex "avoid - shopping places; sex"

gen rp_avoid_shpc_age = 2 if resavoid2_6==1 & avoidance6==1
replace rp_avoid_shpc_age = 1 if resavoid2_6==0 & avoidance6==1
replace rp_avoid_shpc_age =0 if avoidance6==0
replace rp_avoid_shpc_age = -1 if avoidance6==-1
replace rp_avoid_shpc_age = -8 if avoidance6==-8
label define rp_avoid_shpc_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: shopping, etc." 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_shpc_age rp_avoid_shpc_age
label variable rp_avoid_shpc_age "avoid - shopping places; age"

gen rp_avoid_shpc_eth = 2 if resavoid3_6==1 & avoidance6==1
replace rp_avoid_shpc_eth = 1 if resavoid3_6==0 & avoidance6==1
replace rp_avoid_shpc_eth =0 if avoidance6==0
replace rp_avoid_shpc_eth = -1 if avoidance6==-1
replace rp_avoid_shpc_eth = -8 if avoidance6==-8
label define rp_avoid_shpc_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: shopping, etc." 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_shpc_eth rp_avoid_shpc_eth
label variable rp_avoid_shpc_eth "avoid - shopping places; ethnicity"

gen rp_avoid_shpc_sexor = 2 if resavoid4_6==1 & avoidance6==1
replace rp_avoid_shpc_sexor = 1 if resavoid4_6==0 & avoidance6==1
replace rp_avoid_shpc_sexor =0 if avoidance6==0
replace rp_avoid_shpc_sexor = -1 if avoidance6==-1
replace rp_avoid_shpc_sexor = -8 if avoidance6==-8
label define rp_avoid_shpc_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: shopping, etc." 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_shpc_sexor rp_avoid_shpc_sexor
label variable rp_avoid_shpc_sexor "avoid - shopping places; sexual orientation"

gen rp_avoid_shpc_hlth = 2 if resavoid5_6==1 & avoidance6==1
replace rp_avoid_shpc_hlth = 1 if resavoid5_6==0 & avoidance6==1
replace rp_avoid_shpc_hlth =0 if avoidance6==0
replace rp_avoid_shpc_hlth = -1 if avoidance6==-1
replace rp_avoid_shpc_hlth = -8 if avoidance6==-8
label define rp_avoid_shpc_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: shopping, etc." 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_shpc_hlth rp_avoid_shpc_hlth
label variable rp_avoid_shpc_hlth "avoid - shopping places; health and disability"

gen rp_avoid_shpc_nat = 2 if resavoid6_6==1 & avoidance6==1
replace rp_avoid_shpc_nat = 1 if resavoid6_6==0 & avoidance6==1
replace rp_avoid_shpc_nat =0 if avoidance6==0
replace rp_avoid_shpc_nat = -1 if avoidance6==-1
replace rp_avoid_shpc_nat = -8 if avoidance6==-8
label define rp_avoid_shpc_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: shopping, etc." 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_shpc_nat rp_avoid_shpc_nat
label variable rp_avoid_shpc_nat "avoid - shopping places; nationality"

gen rp_avoid_shpc_rel = 2 if resavoid7_6==1 & avoidance6==1
replace rp_avoid_shpc_rel = 1 if resavoid7_6==0 & avoidance6==1
replace rp_avoid_shpc_rel =0 if avoidance6==0
replace rp_avoid_shpc_rel = -1 if avoidance6==-1
replace rp_avoid_shpc_rel = -8 if avoidance6==-8
label define rp_avoid_shpc_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: shopping, etc." 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_shpc_rel rp_avoid_shpc_rel
label variable rp_avoid_shpc_rel "avoid - shopping places; religion"

gen rp_avoid_shpc_lang = 2 if resavoid8_6==1 & avoidance6==1
replace rp_avoid_shpc_lang = 1 if resavoid8_6==0 & avoidance6==1
replace rp_avoid_shpc_lang =0 if avoidance6==0
replace rp_avoid_shpc_lang = -1 if avoidance6==-1
replace rp_avoid_shpc_lang = -8 if avoidance6==-8
label define rp_avoid_shpc_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: shopping, etc." 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_shpc_lang rp_avoid_shpc_lang
label variable rp_avoid_shpc_lang "avoid - shopping places; language or accent"

gen rp_avoid_shpc_drss = 2 if resavoid9_6==1 & avoidance6==1
replace rp_avoid_shpc_drss = 1 if resavoid9_6==0 & avoidance6==1
replace rp_avoid_shpc_drss =0 if avoidance6==0
replace rp_avoid_shpc_drss = -1 if avoidance6==-1
replace rp_avoid_shpc_drss = -8 if avoidance6==-8
label define rp_avoid_shpc_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: shopping, etc." 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_shpc_drss rp_avoid_shpc_drss
label variable rp_avoid_shpc_drss "avoid - shopping places; appearance or dress"

gen rp_avoid_shpc_oth = 2 if resavoid96_6==1 & avoidance6==1
replace rp_avoid_shpc_oth = 1 if resavoid96_6==0 & avoidance6==1
replace rp_avoid_shpc_oth =0 if avoidance6==0
replace rp_avoid_shpc_oth = -1 if avoidance6==-1
replace rp_avoid_shpc_oth = -8 if avoidance6==-8
label define rp_avoid_shpc_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: shopping, etc." 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_shpc_oth rp_avoid_shpc_oth
label variable rp_avoid_shpc_oth "avoid - shopping places; 'other reason'"
replace rp_avoid_shpc_oth = 2 if resavoid97_6==1

* In cinema, cafes, etc

gen rp_avoid_cincf_sex = 2 if resavoid1_7==1 & avoidance7==1
replace rp_avoid_cincf_sex = 1 if resavoid1_7==0 & avoidance7==1
replace rp_avoid_cincf_sex =0 if avoidance7==0
replace rp_avoid_cincf_sex = -1 if avoidance7==-1
replace rp_avoid_cincf_sex = -8 if avoidance7==-8
label define rp_avoid_cincf_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: cinemas, cafes, etc." 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_cincf_sex rp_avoid_cincf_sex
label variable rp_avoid_cincf_sex "avoid - cinema, cafes, etc.; sex"

gen rp_avoid_cincf_age = 2 if resavoid2_7==1 & avoidance7==1
replace rp_avoid_cincf_age = 1 if resavoid2_7==0 & avoidance7==1
replace rp_avoid_cincf_age =0 if avoidance7==0
replace rp_avoid_cincf_age = -1 if avoidance7==-1
replace rp_avoid_cincf_age = -8 if avoidance7==-8
label define rp_avoid_cincf_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: cinemas, cafes, etc." 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_cincf_age rp_avoid_cincf_age
label variable rp_avoid_cincf_age "avoid - cinema, cafes, etc.; age"

gen rp_avoid_cincf_eth = 2 if resavoid3_7==1 & avoidance7==1
replace rp_avoid_cincf_eth = 1 if resavoid3_7==0 & avoidance7==1
replace rp_avoid_cincf_eth =0 if avoidance7==0
replace rp_avoid_cincf_eth = -1 if avoidance7==-1
replace rp_avoid_cincf_eth = -8 if avoidance7==-8
label define rp_avoid_cincf_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: cinemas, cafes, etc." 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_cincf_eth rp_avoid_cincf_eth
label variable rp_avoid_cincf_eth "avoid - cinema, cafes, etc.; ethnicity"

gen rp_avoid_cincf_sexor = 2 if resavoid4_7==1 & avoidance7==1
replace rp_avoid_cincf_sexor = 1 if resavoid4_7==0 & avoidance7==1
replace rp_avoid_cincf_sexor =0 if avoidance7==0
replace rp_avoid_cincf_sexor = -1 if avoidance7==-1
replace rp_avoid_cincf_sexor = -8 if avoidance7==-8
label define rp_avoid_cincf_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: cinemas, cafes, etc." 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_cincf_sexor rp_avoid_cincf_sexor
label variable rp_avoid_cincf_sexor "avoid - cinema, cafes, etc.; sexual orientation"

gen rp_avoid_cincf_hlth = 2 if resavoid5_7==1 & avoidance7==1
replace rp_avoid_cincf_hlth = 1 if resavoid5_7==0 & avoidance7==1
replace rp_avoid_cincf_hlth =0 if avoidance7==0
replace rp_avoid_cincf_hlth = -1 if avoidance7==-1
replace rp_avoid_cincf_hlth = -8 if avoidance7==-8
label define rp_avoid_cincf_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: cinemas, cafes, etc." 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_cincf_hlth rp_avoid_cincf_hlth
label variable rp_avoid_cincf_hlth "avoid - cinema, cafes, etc.; health and disability"

gen rp_avoid_cincf_nat = 2 if resavoid6_7==1 & avoidance7==1
replace rp_avoid_cincf_nat = 1 if resavoid6_7==0 & avoidance7==1
replace rp_avoid_cincf_nat =0 if avoidance7==0
replace rp_avoid_cincf_nat = -1 if avoidance7==-1
replace rp_avoid_cincf_nat = -8 if avoidance7==-8
label define rp_avoid_cincf_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: cinemas, cafes, etc." 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_cincf_nat rp_avoid_cincf_nat
label variable rp_avoid_cincf_nat "avoid - cinema, cafes, etc.; nationality"

gen rp_avoid_cincf_rel = 2 if resavoid7_7==1 & avoidance7==1
replace rp_avoid_cincf_rel = 1 if resavoid7_7==0 & avoidance7==1
replace rp_avoid_cincf_rel =0 if avoidance7==0
replace rp_avoid_cincf_rel = -1 if avoidance7==-1
replace rp_avoid_cincf_rel = -8 if avoidance7==-8
label define rp_avoid_cincf_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: cinemas, cafes, etc." 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_cincf_rel rp_avoid_cincf_rel
label variable rp_avoid_cincf_rel "avoid - cinema, cafes, etc.; religion"

gen rp_avoid_cincf_lang = 2 if resavoid8_7==1 & avoidance7==1
replace rp_avoid_cincf_lang = 1 if resavoid8_7==0 & avoidance7==1
replace rp_avoid_cincf_lang =0 if avoidance7==0
replace rp_avoid_cincf_lang = -1 if avoidance7==-1
replace rp_avoid_cincf_lang = -8 if avoidance7==-8
label define rp_avoid_cincf_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: cinemas, cafes, etc." 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_cincf_lang rp_avoid_cincf_lang
label variable rp_avoid_cincf_lang "avoid - cinema, cafes, etc.; language or accent"

gen rp_avoid_cincf_drss = 2 if resavoid9_7==1 & avoidance7==1
replace rp_avoid_cincf_drss = 1 if resavoid9_7==0 & avoidance7==1
replace rp_avoid_cincf_drss =0 if avoidance7==0
replace rp_avoid_cincf_drss = -1 if avoidance7==-1
replace rp_avoid_cincf_drss = -8 if avoidance7==-8
label define rp_avoid_cincf_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: cinemas, cafes, etc." 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_cincf_drss rp_avoid_cincf_drss
label variable rp_avoid_cincf_drss "avoid - cinema, cafes, etc.; appearance or dress"

gen rp_avoid_cincf_oth = 2 if resavoid96_7==1 & avoidance7==1
replace rp_avoid_cincf_oth = 1 if resavoid96_7==0 & avoidance7==1
replace rp_avoid_cincf_oth =0 if avoidance7==0
replace rp_avoid_cincf_oth = -1 if avoidance7==-1
replace rp_avoid_cincf_oth = -8 if avoidance7==-8
label define rp_avoid_cincf_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: cinemas, cafes, etc." 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_cincf_oth rp_avoid_cincf_oth
label variable rp_avoid_cincf_oth "avoid - cinema, cafes, etc.; 'other reason'"
replace rp_avoid_cincf_oth = 2 if resavoid97_7==1

* Pubs, Discos, Night Clubs, etc.

gen rp_avoid_nsoc_sex = 2 if resavoid1_8==1 & avoidance8==1
replace rp_avoid_nsoc_sex = 1 if resavoid1_8==0 & avoidance8==1
replace rp_avoid_nsoc_sex =0 if avoidance8==0
replace rp_avoid_nsoc_sex = -1 if avoidance8==-1
replace rp_avoid_nsoc_sex = -8 if avoidance8==-8
label define rp_avoid_nsoc_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pubs, clubs, etc." 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_nsoc_sex rp_avoid_nsoc_sex
label variable rp_avoid_nsoc_sex "avoid - Pubs, Clubs, Discos; sex"

gen rp_avoid_nsoc_age = 2 if resavoid2_8==1 & avoidance8==1
replace rp_avoid_nsoc_age = 1 if resavoid2_8==0 & avoidance8==1
replace rp_avoid_nsoc_age =0 if avoidance8==0
replace rp_avoid_nsoc_age = -1 if avoidance8==-1
replace rp_avoid_nsoc_age = -8 if avoidance8==-8
label define rp_avoid_nsoc_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pubs, clubs, etc." 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_nsoc_age rp_avoid_nsoc_age
label variable rp_avoid_nsoc_age "avoid - Pubs, Clubs, Discos; age"

gen rp_avoid_nsoc_eth = 2 if resavoid3_8==1 & avoidance8==1
replace rp_avoid_nsoc_eth = 1 if resavoid3_8==0 & avoidance8==1
replace rp_avoid_nsoc_eth =0 if avoidance8==0
replace rp_avoid_nsoc_eth = -1 if avoidance8==-1
replace rp_avoid_nsoc_eth = -8 if avoidance8==-8
label define rp_avoid_nsoc_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pubs, clubs, etc." 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_nsoc_eth rp_avoid_nsoc_eth
label variable rp_avoid_nsoc_eth "avoid - Pubs, Clubs, Discos; ethnicity"

gen rp_avoid_nsoc_sexor = 2 if resavoid4_8==1 & avoidance8==1
replace rp_avoid_nsoc_sexor = 1 if resavoid4_8==0 & avoidance8==1
replace rp_avoid_nsoc_sexor =0 if avoidance8==0
replace rp_avoid_nsoc_sexor = -1 if avoidance8==-1
replace rp_avoid_nsoc_sexor = -8 if avoidance8==-8
label define rp_avoid_nsoc_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pubs, clubs, etc." 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_nsoc_sexor rp_avoid_nsoc_sexor
label variable rp_avoid_nsoc_sexor "avoid - Pubs, Clubs, Discos; sexual orientation"

gen rp_avoid_nsoc_hlth = 2 if resavoid5_8==1 & avoidance8==1
replace rp_avoid_nsoc_hlth = 1 if resavoid5_8==0 & avoidance8==1
replace rp_avoid_nsoc_hlth =0 if avoidance8==0
replace rp_avoid_nsoc_hlth = -1 if avoidance8==-1
replace rp_avoid_nsoc_hlth = -8 if avoidance8==-8
label define rp_avoid_nsoc_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pubs, clubs, etc." 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_nsoc_hlth rp_avoid_nsoc_hlth
label variable rp_avoid_nsoc_hlth "avoid - Pubs, Clubs, Discos; health and disability"

gen rp_avoid_nsoc_nat = 2 if resavoid6_8==1 & avoidance8==1
replace rp_avoid_nsoc_nat = 1 if resavoid6_8==0 & avoidance8==1
replace rp_avoid_nsoc_nat =0 if avoidance8==0
replace rp_avoid_nsoc_nat = -1 if avoidance8==-1
replace rp_avoid_nsoc_nat = -8 if avoidance8==-8
label define rp_avoid_nsoc_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pubs, clubs, etc." 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_nsoc_nat rp_avoid_nsoc_nat
label variable rp_avoid_nsoc_nat "avoid - Pubs, Clubs, Discos; nationality"

gen rp_avoid_nsoc_rel = 2 if resavoid7_8==1 & avoidance8==1
replace rp_avoid_nsoc_rel = 1 if resavoid7_8==0 & avoidance8==1
replace rp_avoid_nsoc_rel =0 if avoidance8==0
replace rp_avoid_nsoc_rel = -1 if avoidance8==-1
replace rp_avoid_nsoc_rel = -8 if avoidance8==-8
label define rp_avoid_nsoc_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pubs, clubs, etc." 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_nsoc_rel rp_avoid_nsoc_rel
label variable rp_avoid_nsoc_rel "avoid - Pubs, Clubs, Discos; religion"

gen rp_avoid_nsoc_lang = 2 if resavoid8_8==1 & avoidance8==1
replace rp_avoid_nsoc_lang = 1 if resavoid8_8==0 & avoidance8==1
replace rp_avoid_nsoc_lang =0 if avoidance8==0
replace rp_avoid_nsoc_lang = -1 if avoidance8==-1
replace rp_avoid_nsoc_lang = -8 if avoidance8==-8
label define rp_avoid_nsoc_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pubs, clubs, etc." 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_nsoc_lang rp_avoid_nsoc_lang
label variable rp_avoid_nsoc_lang "avoid - Pubs, Clubs, Discos; language or accent"

gen rp_avoid_nsoc_drss = 2 if resavoid9_8==1 & avoidance8==1
replace rp_avoid_nsoc_drss = 1 if resavoid9_8==0 & avoidance8==1
replace rp_avoid_nsoc_drss =0 if avoidance8==0
replace rp_avoid_nsoc_drss = -1 if avoidance8==-1
replace rp_avoid_nsoc_drss = -8 if avoidance8==-8
label define rp_avoid_nsoc_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pubs, clubs, etc." 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_nsoc_drss rp_avoid_nsoc_drss
label variable rp_avoid_nsoc_drss "avoid - Pubs, Clubs, Discos; appearance or dress"

gen rp_avoid_nsoc_oth = 2 if resavoid96_8==1 & avoidance8==1
replace rp_avoid_nsoc_oth = 1 if resavoid96_8==0 & avoidance8==1
replace rp_avoid_nsoc_oth =0 if avoidance8==0
replace rp_avoid_nsoc_oth = -1 if avoidance8==-1
replace rp_avoid_nsoc_oth = -8 if avoidance8==-8
label define rp_avoid_nsoc_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: pubs, clubs, etc." 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_nsoc_oth rp_avoid_nsoc_oth
label variable rp_avoid_nsoc_oth "avoid - Pubs, Clubs, Discos	; 'other reason'"
replace rp_avoid_nsoc_oth = 2 if resavoid97_8==1

* Car Parks

gen rp_avoid_cpark_sex = 2 if resavoid1_9==1 & avoidance9==1
replace rp_avoid_cpark_sex = 1 if resavoid1_9==0 & avoidance9==1
replace rp_avoid_cpark_sex =0 if avoidance9==0
replace rp_avoid_cpark_sex = -1 if avoidance9==-1
replace rp_avoid_cpark_sex = -8 if avoidance9==-8
label define rp_avoid_cpark_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: Car parks" 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_cpark_sex rp_avoid_cpark_sex
label variable rp_avoid_cpark_sex "avoid - Car Parks; sex"

gen rp_avoid_cpark_age = 2 if resavoid2_9==1 & avoidance9==1
replace rp_avoid_cpark_age = 1 if resavoid2_9==0 & avoidance9==1
replace rp_avoid_cpark_age =0 if avoidance9==0
replace rp_avoid_cpark_age = -1 if avoidance9==-1
replace rp_avoid_cpark_age = -8 if avoidance9==-8
label define rp_avoid_cpark_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: Car parks" 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_cpark_age rp_avoid_cpark_age
label variable rp_avoid_cpark_age "avoid - Car Parks; age"

gen rp_avoid_cpark_eth = 2 if resavoid3_9==1 & avoidance9==1
replace rp_avoid_cpark_eth = 1 if resavoid3_9==0 & avoidance9==1
replace rp_avoid_cpark_eth =0 if avoidance9==0
replace rp_avoid_cpark_eth = -1 if avoidance9==-1
replace rp_avoid_cpark_eth = -8 if avoidance9==-8
label define rp_avoid_cpark_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: Car parks" 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_cpark_eth rp_avoid_cpark_eth
label variable rp_avoid_cpark_eth "avoid - Car Parks; ethnicity"

gen rp_avoid_cpark_sexor = 2 if resavoid4_9==1 & avoidance9==1
replace rp_avoid_cpark_sexor = 1 if resavoid4_9==0 & avoidance9==1
replace rp_avoid_cpark_sexor =0 if avoidance9==0
replace rp_avoid_cpark_sexor = -1 if avoidance9==-1
replace rp_avoid_cpark_sexor = -8 if avoidance9==-8
label define rp_avoid_cpark_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: Car parks" 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_cpark_sexor rp_avoid_cpark_sexor
label variable rp_avoid_cpark_sexor "avoid - Car Parks; sexual orientation"

gen rp_avoid_cpark_hlth = 2 if resavoid5_9==1 & avoidance9==1
replace rp_avoid_cpark_hlth = 1 if resavoid5_9==0 & avoidance9==1
replace rp_avoid_cpark_hlth =0 if avoidance9==0
replace rp_avoid_cpark_hlth = -1 if avoidance9==-1
replace rp_avoid_cpark_hlth = -8 if avoidance9==-8
label define rp_avoid_cpark_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: Car parks" 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_cpark_hlth rp_avoid_cpark_hlth
label variable rp_avoid_cpark_hlth "avoid - Car Parks; health and disability"

gen rp_avoid_cpark_nat = 2 if resavoid6_9==1 & avoidance9==1
replace rp_avoid_cpark_nat = 1 if resavoid6_9==0 & avoidance9==1
replace rp_avoid_cpark_nat =0 if avoidance9==0
replace rp_avoid_cpark_nat = -1 if avoidance9==-1
replace rp_avoid_cpark_nat = -8 if avoidance9==-8
label define rp_avoid_cpark_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: Car parks" 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_cpark_nat rp_avoid_cpark_nat
label variable rp_avoid_cpark_nat "avoid - Car Parks; nationality"

gen rp_avoid_cpark_rel = 2 if resavoid7_9==1 & avoidance9==1
replace rp_avoid_cpark_rel = 1 if resavoid7_9==0 & avoidance9==1
replace rp_avoid_cpark_rel =0 if avoidance9==0
replace rp_avoid_cpark_rel = -1 if avoidance9==-1
replace rp_avoid_cpark_rel = -8 if avoidance9==-8
label define rp_avoid_cpark_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: Car parks" 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_cpark_rel rp_avoid_cpark_rel
label variable rp_avoid_cpark_rel "avoid - Car Parks; religion"

gen rp_avoid_cpark_lang = 2 if resavoid8_9==1 & avoidance9==1
replace rp_avoid_cpark_lang = 1 if resavoid8_9==0 & avoidance9==1
replace rp_avoid_cpark_lang =0 if avoidance9==0
replace rp_avoid_cpark_lang = -1 if avoidance9==-1
replace rp_avoid_cpark_lang = -8 if avoidance9==-8
label define rp_avoid_cpark_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: Car parks" 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_cpark_lang rp_avoid_cpark_lang
label variable rp_avoid_cpark_lang "avoid - Car Parks; language or accent"

gen rp_avoid_cpark_drss = 2 if resavoid9_9==1 & avoidance9==1
replace rp_avoid_cpark_drss = 1 if resavoid9_9==0 & avoidance9==1
replace rp_avoid_cpark_drss =0 if avoidance9==0
replace rp_avoid_cpark_drss = -1 if avoidance9==-1
replace rp_avoid_cpark_drss = -8 if avoidance9==-8
label define rp_avoid_cpark_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: Car parks" 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_cpark_drss rp_avoid_cpark_drss
label variable rp_avoid_cpark_drss "avoid - Car Parks; appearance or dress"

gen rp_avoid_cpark_oth = 2 if resavoid96_9==1 & avoidance9==1
replace rp_avoid_cpark_oth = 1 if resavoid96_9==0 & avoidance9==1
replace rp_avoid_cpark_oth =0 if avoidance9==0
replace rp_avoid_cpark_oth = -1 if avoidance9==-1
replace rp_avoid_cpark_oth = -8 if avoidance9==-8
label define rp_avoid_cpark_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: Car parks" 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_cpark_oth rp_avoid_cpark_oth
label variable rp_avoid_cpark_oth "avoid - Car Parks; 'other reason'"
replace rp_avoid_cpark_oth = 2 if resavoid97_9==1

* Outside (streets/parks)

gen rp_avoid_out_sex = 2 if resavoid1_10==1 & avoidance10==1
replace rp_avoid_out_sex = 1 if resavoid1_10==0 & avoidance10==1
replace rp_avoid_out_sex =0 if avoidance10==0
replace rp_avoid_out_sex = -1 if avoidance10==-1
replace rp_avoid_out_sex = -8 if avoidance10==-8
label define rp_avoid_out_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: outside (streets, parks, etc.)" 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_out_sex rp_avoid_out_sex
label variable rp_avoid_out_sex "avoid - outside (streets, parks, etc.); sex"

gen rp_avoid_out_age = 2 if resavoid2_10==1 & avoidance10==1
replace rp_avoid_out_age = 1 if resavoid2_10==0 & avoidance10==1
replace rp_avoid_out_age =0 if avoidance10==0
replace rp_avoid_out_age = -1 if avoidance10==-1
replace rp_avoid_out_age = -8 if avoidance10==-8
label define rp_avoid_out_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: outside (streets, parks, etc.)" 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_out_age rp_avoid_out_age
label variable rp_avoid_out_age "avoid - outside (streets, parks, etc.); age"

gen rp_avoid_out_eth = 2 if resavoid3_10==1 & avoidance10==1
replace rp_avoid_out_eth = 1 if resavoid3_10==0 & avoidance10==1
replace rp_avoid_out_eth =0 if avoidance10==0
replace rp_avoid_out_eth = -1 if avoidance10==-1
replace rp_avoid_out_eth = -8 if avoidance10==-8
label define rp_avoid_out_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: outside (streets, parks, etc.)" 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_out_eth rp_avoid_out_eth
label variable rp_avoid_out_eth "avoid - outside (streets, parks, etc.); ethnicity"

gen rp_avoid_out_sexor = 2 if resavoid4_10==1 & avoidance10==1
replace rp_avoid_out_sexor = 1 if resavoid4_10==0 & avoidance10==1
replace rp_avoid_out_sexor =0 if avoidance10==0
replace rp_avoid_out_sexor = -1 if avoidance10==-1
replace rp_avoid_out_sexor = -8 if avoidance10==-8
label define rp_avoid_out_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: outside (streets, parks, etc.)" 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_out_sexor rp_avoid_out_sexor
label variable rp_avoid_out_sexor "avoid - outside (streets, parks, etc.); sexual orientation"

gen rp_avoid_out_hlth = 2 if resavoid5_10==1 & avoidance10==1
replace rp_avoid_out_hlth = 1 if resavoid5_10==0 & avoidance10==1
replace rp_avoid_out_hlth =0 if avoidance10==0
replace rp_avoid_out_hlth = -1 if avoidance10==-1
replace rp_avoid_out_hlth = -8 if avoidance10==-8
label define rp_avoid_out_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: outside (streets, parks, etc.)" 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_out_hlth rp_avoid_out_hlth
label variable rp_avoid_out_hlth "avoid - outside (streets, parks, etc.); health and disability"

gen rp_avoid_out_nat = 2 if resavoid6_10==1 & avoidance10==1
replace rp_avoid_out_nat = 1 if resavoid6_10==0 & avoidance10==1
replace rp_avoid_out_nat =0 if avoidance10==0
replace rp_avoid_out_nat = -1 if avoidance10==-1
replace rp_avoid_out_nat = -8 if avoidance10==-8
label define rp_avoid_out_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: outside (streets, parks, etc.)" 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_out_nat rp_avoid_out_nat
label variable rp_avoid_out_nat "avoid - outside (streets, parks, etc.); nationality"

gen rp_avoid_out_rel = 2 if resavoid7_10==1 & avoidance10==1
replace rp_avoid_out_rel = 1 if resavoid7_10==0 & avoidance10==1
replace rp_avoid_out_rel =0 if avoidance10==0
replace rp_avoid_out_rel = -1 if avoidance10==-1
replace rp_avoid_out_rel = -8 if avoidance10==-8
label define rp_avoid_out_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: outside (streets, parks, etc.)" 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_out_rel rp_avoid_out_rel
label variable rp_avoid_out_rel "avoid - outside (streets, parks, etc.); religion"

gen rp_avoid_out_lang = 2 if resavoid8_10==1 & avoidance10==1
replace rp_avoid_out_lang = 1 if resavoid8_10==0 & avoidance10==1
replace rp_avoid_out_lang =0 if avoidance10==0
replace rp_avoid_out_lang = -1 if avoidance10==-1
replace rp_avoid_out_lang = -8 if avoidance10==-8
label define rp_avoid_out_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: outside (streets, parks, etc.)" 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_out_lang rp_avoid_out_lang
label variable rp_avoid_out_lang "avoid - outside (streets, parks, etc.); language or accent"

gen rp_avoid_out_drss = 2 if resavoid9_10==1 & avoidance10==1
replace rp_avoid_out_drss = 1 if resavoid9_10==0 & avoidance10==1
replace rp_avoid_out_drss =0 if avoidance10==0
replace rp_avoid_out_drss = -1 if avoidance10==-1
replace rp_avoid_out_drss = -8 if avoidance10==-8
label define rp_avoid_out_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: outside (streets, parks, etc.)" 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_out_drss rp_avoid_out_drss
label variable rp_avoid_out_drss "avoid - outside (streets, parks, etc.); appearance or dress"

gen rp_avoid_out_oth = 2 if resavoid96_10==1 & avoidance10==1
replace rp_avoid_out_oth = 1 if resavoid96_10==0 & avoidance10==1
replace rp_avoid_out_oth =0 if avoidance10==0
replace rp_avoid_out_oth = -1 if avoidance10==-1
replace rp_avoid_out_oth = -8 if avoidance10==-8
label define rp_avoid_out_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: outside (streets, parks, etc.)" 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_out_oth rp_avoid_out_oth
label variable rp_avoid_out_oth "avoid - outside (streets, parks, etc.); 'other reason'"
replace rp_avoid_out_oth = 2 if resavoid97_10==1

* Home

gen rp_avoid_home_sex = 2 if resavoid1_11==1 & avoidance11==1
replace rp_avoid_home_sex = 1 if resavoid1_11==0 & avoidance11==1
replace rp_avoid_home_sex =0 if avoidance11==0
replace rp_avoid_home_sex = -1 if avoidance11==-1
replace rp_avoid_home_sex = -8 if avoidance11==-8
label define rp_avoid_home_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: at home" 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_home_sex rp_avoid_home_sex
label variable rp_avoid_home_sex "avoid - at home; sex"

gen rp_avoid_home_age = 2 if resavoid2_11==1 & avoidance11==1
replace rp_avoid_home_age = 1 if resavoid2_11==0 & avoidance11==1
replace rp_avoid_home_age =0 if avoidance11==0
replace rp_avoid_home_age = -1 if avoidance11==-1
replace rp_avoid_home_age = -8 if avoidance11==-8
label define rp_avoid_home_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: at home" 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_home_age rp_avoid_home_age
label variable rp_avoid_home_age "avoid - at home; age"

gen rp_avoid_home_eth = 2 if resavoid3_11==1 & avoidance11==1
replace rp_avoid_home_eth = 1 if resavoid3_11==0 & avoidance11==1
replace rp_avoid_home_eth =0 if avoidance11==0
replace rp_avoid_home_eth = -1 if avoidance11==-1
replace rp_avoid_home_eth = -8 if avoidance11==-8
label define rp_avoid_home_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: at home" 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_home_eth rp_avoid_home_eth
label variable rp_avoid_home_eth "avoid - at home; ethnicity"

gen rp_avoid_home_sexor = 2 if resavoid4_11==1 & avoidance11==1
replace rp_avoid_home_sexor = 1 if resavoid4_11==0 & avoidance11==1
replace rp_avoid_home_sexor =0 if avoidance11==0
replace rp_avoid_home_sexor = -1 if avoidance11==-1
replace rp_avoid_home_sexor = -8 if avoidance11==-8
label define rp_avoid_home_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: at home" 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_home_sexor rp_avoid_home_sexor
label variable rp_avoid_home_sexor "avoid - at home; sexual orientation"

gen rp_avoid_home_hlth = 2 if resavoid5_11==1 & avoidance11==1
replace rp_avoid_home_hlth = 1 if resavoid5_11==0 & avoidance11==1
replace rp_avoid_home_hlth =0 if avoidance11==0
replace rp_avoid_home_hlth = -1 if avoidance11==-1
replace rp_avoid_home_hlth = -8 if avoidance11==-8
label define rp_avoid_home_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: at home" 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_home_hlth rp_avoid_home_hlth
label variable rp_avoid_home_hlth "avoid - at home; health and disability"

gen rp_avoid_home_nat = 2 if resavoid6_11==1 & avoidance11==1
replace rp_avoid_home_nat = 1 if resavoid6_11==0 & avoidance11==1
replace rp_avoid_home_nat =0 if avoidance11==0
replace rp_avoid_home_nat = -1 if avoidance11==-1
replace rp_avoid_home_nat = -8 if avoidance11==-8
label define rp_avoid_home_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: at home" 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_home_nat rp_avoid_home_nat
label variable rp_avoid_home_nat "avoid - at home; nationality"

gen rp_avoid_home_rel = 2 if resavoid7_11==1 & avoidance11==1
replace rp_avoid_home_rel = 1 if resavoid7_11==0 & avoidance11==1
replace rp_avoid_home_rel =0 if avoidance11==0
replace rp_avoid_home_rel = -1 if avoidance11==-1
replace rp_avoid_home_rel = -8 if avoidance11==-8
label define rp_avoid_home_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: at home" 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_home_rel rp_avoid_home_rel
label variable rp_avoid_home_rel "avoid - at home; religion"

gen rp_avoid_home_lang = 2 if resavoid8_11==1 & avoidance11==1
replace rp_avoid_home_lang = 1 if resavoid8_11==0 & avoidance11==1
replace rp_avoid_home_lang =0 if avoidance11==0
replace rp_avoid_home_lang = -1 if avoidance11==-1
replace rp_avoid_home_lang = -8 if avoidance11==-8
label define rp_avoid_home_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: at home" 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_home_lang rp_avoid_home_lang
label variable rp_avoid_home_lang "avoid - at home; language or accent"

gen rp_avoid_home_drss = 2 if resavoid9_11==1 & avoidance11==1
replace rp_avoid_home_drss = 1 if resavoid9_11==0 & avoidance11==1
replace rp_avoid_home_drss =0 if avoidance11==0
replace rp_avoid_home_drss = -1 if avoidance11==-1
replace rp_avoid_home_drss = -8 if avoidance11==-8
label define rp_avoid_home_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: at home" 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_home_drss rp_avoid_home_drss
label variable rp_avoid_home_drss "avoid - at home; appearance or dress"

gen rp_avoid_home_oth = 2 if resavoid96_11==1 & avoidance11==1
replace rp_avoid_home_oth = 1 if resavoid96_11==0 & avoidance11==1
replace rp_avoid_home_oth =0 if avoidance11==0
replace rp_avoid_home_oth = -1 if avoidance11==-1
replace rp_avoid_home_oth = -8 if avoidance11==-8
label define rp_avoid_home_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: at home" 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_home_oth rp_avoid_home_oth
label variable rp_avoid_home_oth "avoid - at home; 'other reason'"
replace rp_avoid_home_oth = 2 if resavoid97_11==1

* Other

gen rp_avoid_other_sex = 2 if resavoid1_12==1 & p_avoid_other==1
replace rp_avoid_other_sex = 1 if resavoid1_12==0 & p_avoid_other==1
replace rp_avoid_other_sex =0 if p_avoid_other==0
replace rp_avoid_other_sex = -1 if p_avoid_other==-1
replace rp_avoid_other_sex = -8 if p_avoid_other==-8
label define rp_avoid_other_sex -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: other place" 1 "avoid: not sex" 2 "avoid: sex", modify
label values rp_avoid_other_sex rp_avoid_other_sex
label variable rp_avoid_other_sex "avoid - other place; sex"

gen rp_avoid_other_age = 2 if resavoid2_12==1 & p_avoid_other==1
replace rp_avoid_other_age = 1 if resavoid2_12==0 & p_avoid_other==1
replace rp_avoid_other_age =0 if p_avoid_other==0
replace rp_avoid_other_age = -1 if p_avoid_other==-1
replace rp_avoid_other_age = -8 if p_avoid_other==-8
label define rp_avoid_other_age -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: other place" 1 "avoid: not age" 2 "avoid: age", modify
label values rp_avoid_other_age rp_avoid_other_age
label variable rp_avoid_other_age "avoid - other place; age"

gen rp_avoid_other_eth = 2 if resavoid3_12==1 & p_avoid_other==1
replace rp_avoid_other_eth = 1 if resavoid3_12==0 & p_avoid_other==1
replace rp_avoid_other_eth =0 if p_avoid_other==0
replace rp_avoid_other_eth = -1 if p_avoid_other==-1
replace rp_avoid_other_eth = -8 if p_avoid_other==-8
label define rp_avoid_other_eth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: other place" 1 "avoid: not ethnicity" 2 "avoid: ethnicity", modify
label values rp_avoid_other_eth rp_avoid_other_eth
label variable rp_avoid_other_eth "avoid - other place; ethnicity"

gen rp_avoid_other_sexor = 2 if resavoid4_12==1 & p_avoid_other==1
replace rp_avoid_other_sexor = 1 if resavoid4_12==0 & p_avoid_other==1
replace rp_avoid_other_sexor =0 if p_avoid_other==0
replace rp_avoid_other_sexor = -1 if p_avoid_other==-1
replace rp_avoid_other_sexor = -8 if p_avoid_other==-8
label define rp_avoid_other_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: other place" 1 "avoid: not sexual orientation" 2 "avoid: sexual orientation", modify
label values rp_avoid_other_sexor rp_avoid_other_sexor
label variable rp_avoid_other_sexor "avoid - other place; sexual orientation"

gen rp_avoid_other_hlth = 2 if resavoid5_12==1 & p_avoid_other==1
replace rp_avoid_other_hlth = 1 if resavoid5_12==0 & p_avoid_other==1
replace rp_avoid_other_hlth =0 if p_avoid_other==0
replace rp_avoid_other_hlth = -1 if p_avoid_other==-1
replace rp_avoid_other_hlth = -8 if p_avoid_other==-8
label define rp_avoid_other_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: other place" 1 "avoid: not health and disability" 2 "avoid: health and disability", modify
label values rp_avoid_other_hlth rp_avoid_other_hlth
label variable rp_avoid_other_hlth "avoid - other place; health and disability"

gen rp_avoid_other_nat = 2 if resavoid6_12==1 & p_avoid_other==1
replace rp_avoid_other_nat = 1 if resavoid6_12==0 & p_avoid_other==1
replace rp_avoid_other_nat =0 if p_avoid_other==0
replace rp_avoid_other_nat = -1 if p_avoid_other==-1
replace rp_avoid_other_nat = -8 if p_avoid_other==-8
label define rp_avoid_other_nat -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: other place" 1 "avoid: not nationality" 2 "avoid: nationality", modify
label values rp_avoid_other_nat rp_avoid_other_nat
label variable rp_avoid_other_nat "avoid - other place; nationality"

gen rp_avoid_other_rel = 2 if resavoid7_12==1 & p_avoid_other==1
replace rp_avoid_other_rel = 1 if resavoid7_12==0 & p_avoid_other==1
replace rp_avoid_other_rel =0 if p_avoid_other==0
replace rp_avoid_other_rel = -1 if p_avoid_other==-1
replace rp_avoid_other_rel = -8 if p_avoid_other==-8
label define rp_avoid_other_rel -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: other place" 1 "avoid: not religion" 2 "avoid: religion", modify
label values rp_avoid_other_rel rp_avoid_other_rel
label variable rp_avoid_other_rel "avoid - other place; religion"

gen rp_avoid_other_lang = 2 if resavoid8_12==1 & p_avoid_other==1
replace rp_avoid_other_lang = 1 if resavoid8_12==0 & p_avoid_other==1
replace rp_avoid_other_lang =0 if p_avoid_other==0
replace rp_avoid_other_lang = -1 if p_avoid_other==-1
replace rp_avoid_other_lang = -8 if p_avoid_other==-8
label define rp_avoid_other_lang -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: other place" 1 "avoid: not language or accent" 2 "avoid: language or accent", modify
label values rp_avoid_other_lang rp_avoid_other_lang
label variable rp_avoid_other_lang "avoid - other place; language or accent"

gen rp_avoid_other_drss = 2 if resavoid9_12==1 & p_avoid_other==1
replace rp_avoid_other_drss = 1 if resavoid9_12==0 & p_avoid_other==1
replace rp_avoid_other_drss =0 if p_avoid_other==0
replace rp_avoid_other_drss = -1 if p_avoid_other==-1
replace rp_avoid_other_drss = -8 if p_avoid_other==-8
label define rp_avoid_other_drss -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: other place" 1 "avoid: not appearance or dress" 2 "avoid: appearance or dress", modify
label values rp_avoid_other_drss rp_avoid_other_drss
label variable rp_avoid_other_drss "avoid - other place; appearance or dress"

gen rp_avoid_other_oth = 2 if resavoid96_12==1 & p_avoid_other==1
replace rp_avoid_other_oth = 1 if resavoid96_12==0 & p_avoid_other==1
replace rp_avoid_other_oth =0 if p_avoid_other==0
replace rp_avoid_other_oth = -1 if p_avoid_other==-1
replace rp_avoid_other_oth = -8 if p_avoid_other==-8
label define rp_avoid_other_oth -8 "Inapplicable" -1 "Don't know" 0 "Not avoided: other place" 1 "avoid: not 'other reason'" 2 "avoid: 'other reason'", modify
label values rp_avoid_other_oth rp_avoid_other_oth
label variable rp_avoid_other_oth "avoid - other place; 'other reason'"
replace rp_avoid_other_oth = 2 if resavoid97_12==1

********************************************************************************

//v1
ge insulted_anywhere=.
replace insulted_anywhere=1 if insulted96==0
replace insulted_anywhere=0 if insulted96==1
replace insulted_anywhere=-8 if insulted96==-8

lab var insulted_anywhere "whether insulted any place"
lab define insulted_anywhere_lab 0"no" 1"yes" -8"not applicable"
lab val insulted_anywhere insulted_anywhere_lab

//v2
ge insulted_anywhere2=.
replace insulted_anywhere2=1 if insulted96==0
replace insulted_anywhere2=0 if insulted96==1

lab var insulted_anywhere2 "whether insulted any place- no inapplicable"
lab val insulted_anywhere2 insulted_anywhere2_lab

***
*** Measures of WHERE people were insulted
***

clonevar p_insult_schl = insulted1
clonevar p_insult_uni = insulted2
clonevar p_insult_wrk = insulted3
clonevar p_insult_ptran = insulted4
clonevar p_insult_btstn = insulted5
clonevar p_insult_shpc = insulted6
clonevar p_insult_cincf = insulted7
clonevar p_insult_nsoc = insulted8
clonevar p_insult_cpark = insulted9
clonevar p_insult_out = insulted10
clonevar p_insult_home = insulted11
clonevar p_insult_other = insulted97
label variable p_insult_schl "Place(s) insulted: School"
label variable p_insult_uni "Place(s) insulted: College/University"
label variable p_insult_wrk "Place(s) insulted: at work"
label variable p_insult_ptran "Place(s) insulted: On public transport"
label variable p_insult_btstn "Place(s) insulted: At/near Bus/train station"
label variable p_insult_shpc "Place(s) insulted: In Shopping Centres, etc"
label variable p_insult_cincf "Place(s) insulted: In cinema, cafes, etc."
label variable p_insult_nsoc "Place(s) insulted: At pub/disco/club"
label variable p_insult_cpark "Place(s) insulted: in car parks"
label variable p_insult_out "Place(s) insulted: Outside, street/park"
label variable p_insult_home "Place(s) insulted: at home"
label variable p_insult_other "Place(s) insulted: Other Places"

* Recoding p_unsafe missings

recode p_insult_schl- p_insult_other (-9=.) (-7/-2=.)

* Recoding 'other places' into p_unsafe variables

replace p_insult_schl = 1 if p_insult_schl!=1 & insultedo_code==1
replace p_insult_uni = 1 if p_insult_uni!=1 & insultedo_code==2
replace p_insult_wrk = 1 if p_insult_wrk!=1 & insultedo_code==3
replace p_insult_ptran = 1 if p_insult_ptran!=1 & insultedo_code==4
replace p_insult_btstn = 1 if p_insult_btstn!=1 & insultedo_code==5
replace p_insult_shpc = 1 if p_insult_shpc!=1 & insultedo_code==6
replace p_insult_cincf = 1 if p_insult_cincf!=1 & insultedo_code==7
replace p_insult_nsoc = 1 if p_insult_nsoc!=1 & insultedo_code==8
replace p_insult_cpark = 1 if p_insult_cpark!=1 & insultedo_code==9
replace p_insult_out = 1 if p_insult_out!=1 & insultedo_code==10
replace p_insult_home = 1 if p_insult_home!=1 & insultedo_code==11

* Removing these 'substantive' options from the 'p_insult_other' variable

replace p_insult_other = 0 if unsafeo_code>2 & insultedo_code<12

***
*** Measures of WHY people were insulted 
***

* Sex

gen r_insult_sex = .
replace r_insult_sex = 1 if resinsulted1_1==1 | resinsulted1_2==1 | resinsulted1_3==1 | resinsulted1_4==1 | resinsulted1_5==1 | resinsulted1_6==1 | resinsulted1_7==1 | resinsulted1_8==1 | resinsulted1_9==1 | resinsulted1_10==1 | resinsulted1_11==1 | resinsulted1_12==1
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_1==0
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_2==0
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_3==0
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_4==0
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_5==0
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_6==0
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_7==0
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_8==0
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_9==0
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_10==0
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_11==0
replace r_insult_sex = 0 if r_insult_sex!=1 & resinsulted1_12==0

replace r_insult_sex = 0 if (r_insult_sex!=1 | r_insult_sex!=0) & insulted_anywhere==0
replace r_insult_sex = -8 if (r_insult_sex!=1 | r_insult_sex!=0) & insulted_anywhere==-8

label define r_ -8 "Inapplicable" 0 "No" 1 "Yes", modify
label values r_insult_sex r_
label variable r_insult_sex "Reason insulted: sex"

* Age

gen r_insult_age = .
replace r_insult_age = 1 if resinsulted2_1==1 | resinsulted2_2==1 | resinsulted2_3==1 | resinsulted2_4==1 | resinsulted2_5==1 | resinsulted2_6==1 | resinsulted2_7==1 | resinsulted2_8==1 | resinsulted2_9==1 | resinsulted2_10==1 | resinsulted2_11==1 | resinsulted2_12==1
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_1==0
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_2==0
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_3==0
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_4==0
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_5==0
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_6==0
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_7==0
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_8==0
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_9==0
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_10==0
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_11==0
replace r_insult_age = 0 if r_insult_age!=1 & resinsulted2_12==0

replace r_insult_age = 0 if (r_insult_age!=1 | r_insult_age!=0) & insulted_anywhere==0
replace r_insult_age = -8 if (r_insult_age!=1 | r_insult_age!=0) & insulted_anywhere==-8

label values r_insult_age r_
label variable r_insult_age "Reason insulted: age"

* Ethnicity

gen r_insult_eth = .
replace r_insult_eth = 1 if resinsulted3_1==1 | resinsulted3_2==1 | resinsulted3_3==1 | resinsulted3_4==1 | resinsulted3_5==1 | resinsulted3_6==1 | resinsulted3_7==1 | resinsulted3_8==1 | resinsulted3_9==1 | resinsulted3_10==1 | resinsulted3_11==1 | resinsulted3_12==1
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_1==0
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_2==0
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_3==0
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_4==0
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_5==0
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_6==0
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_7==0
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_8==0
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_9==0
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_10==0
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_11==0
replace r_insult_eth = 0 if r_insult_eth!=1 & resinsulted3_12==0

replace r_insult_eth = 0 if (r_insult_eth!=1 | r_insult_eth!=0) & insulted_anywhere==0
replace r_insult_eth = -8 if (r_insult_eth!=1 | r_insult_eth!=0) & insulted_anywhere==-8

label values r_insult_eth r_
label variable r_insult_eth "Reason insulted: ethnicity"

* Sexual Orientation

gen r_insult_sexor = .
replace r_insult_sexor = 1 if resinsulted4_1==1 | resinsulted4_2==1 | resinsulted4_3==1 | resinsulted4_4==1 | resinsulted4_5==1 | resinsulted4_6==1 | resinsulted4_7==1 | resinsulted4_8==1 | resinsulted4_9==1 | resinsulted4_10==1 | resinsulted4_11==1 | resinsulted4_12==1
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_1==0
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_2==0
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_3==0
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_4==0
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_5==0
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_6==0
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_7==0
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_8==0
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_9==0
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_10==0
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_11==0
replace r_insult_sexor = 0 if r_insult_sexor!=1 & resinsulted4_12==0

replace r_insult_sexor = 0 if (r_insult_sexor!=1 | r_insult_sexor!=0) & insulted_anywhere==0
replace r_insult_sexor = -8 if (r_insult_sexor!=1 | r_insult_sexor!=0) & insulted_anywhere==-8

label values r_insult_sexor r_
label variable r_insult_sexor "Reason insulted: sexual orientation"

* Disability

gen r_insult_hlth = .
replace r_insult_hlth = 1 if resinsulted5_1==1 | resinsulted5_2==1 | resinsulted5_3==1 | resinsulted5_4==1 | resinsulted5_5==1 | resinsulted5_6==1 | resinsulted5_7==1 | resinsulted5_8==1 | resinsulted5_9==1 | resinsulted5_10==1 | resinsulted5_11==1 | resinsulted5_12==1
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_1==0
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_2==0
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_3==0
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_4==0
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_5==0
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_6==0
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_7==0
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_8==0
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_9==0
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_10==0
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_11==0
replace r_insult_hlth = 0 if r_insult_hlth!=1 & resinsulted5_12==0

replace r_insult_hlth = 0 if (r_insult_hlth!=1 | r_insult_hlth!=0) & insulted_anywhere==0
replace r_insult_hlth = -8 if (r_insult_hlth!=1 | r_insult_hlth!=0) & insulted_anywhere==-8

label values r_insult_hlth r_
label variable r_insult_hlth "Reason insulted: health and disability"

* Nationality

gen r_insult_nat = .
replace r_insult_nat = 1 if resinsulted6_1==1 | resinsulted6_2==1 | resinsulted6_3==1 | resinsulted6_4==1 | resinsulted6_5==1 | resinsulted6_6==1 | resinsulted6_7==1 | resinsulted6_8==1 | resinsulted6_9==1 | resinsulted6_10==1 | resinsulted6_11==1 | resinsulted6_12==1
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_1==0
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_2==0
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_3==0
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_4==0
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_5==0
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_6==0
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_7==0
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_8==0
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_9==0
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_10==0
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_11==0
replace r_insult_nat = 0 if r_insult_nat!=1 & resinsulted6_12==0

replace r_insult_nat = 0 if (r_insult_nat!=1 | r_insult_nat!=0) & insulted_anywhere==0
replace r_insult_nat = -8 if (r_insult_nat!=1 | r_insult_nat!=0) & insulted_anywhere==-8

label values r_insult_nat r_
label variable r_insult_nat "Reason insulted: nationality"

* Religion

gen r_insult_rel = .
replace r_insult_rel = 1 if resinsulted7_1==1 | resinsulted7_2==1 | resinsulted7_3==1 | resinsulted7_4==1 | resinsulted7_5==1 | resinsulted7_6==1 | resinsulted7_7==1 | resinsulted7_8==1 | resinsulted7_9==1 | resinsulted7_10==1 | resinsulted7_11==1 | resinsulted7_12==1
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_1==0
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_2==0
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_3==0
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_4==0
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_5==0
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_6==0
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_7==0
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_8==0
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_9==0
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_10==0
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_11==0
replace r_insult_rel = 0 if r_insult_rel!=1 & resinsulted7_12==0

replace r_insult_rel = 0 if (r_insult_rel!=1 | r_insult_rel!=0) & insulted_anywhere==0
replace r_insult_rel = -8 if (r_insult_rel!=1 | r_insult_rel!=0) & insulted_anywhere==-8

label values r_insult_rel r_
label variable r_insult_rel "Reason insulted: religion"

* Language/Accent

gen r_insult_lang = .
replace r_insult_lang = 1 if resinsulted8_1==1 | resinsulted8_2==1 | resinsulted8_3==1 | resinsulted8_4==1 | resinsulted8_5==1 | resinsulted8_6==1 | resinsulted8_7==1 | resinsulted8_8==1 | resinsulted8_9==1 | resinsulted8_10==1 | resinsulted8_11==1 | resinsulted8_12==1
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_1==0
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_2==0
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_3==0
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_4==0
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_5==0
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_6==0
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_7==0
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_8==0
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_9==0
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_10==0
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_11==0
replace r_insult_lang = 0 if r_insult_lang!=1 & resinsulted8_12==0

replace r_insult_lang = 0 if (r_insult_lang!=1 | r_insult_lang!=0) & insulted_anywhere==0
replace r_insult_lang = -8 if (r_insult_lang!=1 | r_insult_lang!=0) & insulted_anywhere==-8

label values r_insult_lang r_
label variable r_insult_lang "Reason insulted: language or accent"

* Language/Accent

gen r_insult_drss = .
replace r_insult_drss = 1 if resinsulted9_1==1 | resinsulted9_2==1 | resinsulted9_3==1 | resinsulted9_4==1 | resinsulted9_5==1 | resinsulted9_6==1 | resinsulted9_7==1 | resinsulted9_8==1 | resinsulted9_9==1 | resinsulted9_10==1 | resinsulted9_11==1 | resinsulted9_12==1
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_1==0
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_2==0
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_3==0
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_4==0
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_5==0
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_6==0
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_7==0
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_8==0
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_9==0
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_10==0
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_11==0
replace r_insult_drss = 0 if r_insult_drss!=1 & resinsulted9_12==0

replace r_insult_drss = 0 if (r_insult_drss!=1 | r_insult_drss!=0) & insulted_anywhere==0
replace r_insult_drss = -8 if (r_insult_drss!=1 | r_insult_drss!=0) & insulted_anywhere==-8

label values r_insult_drss r_
label variable r_insult_drss "Reason insulted: appearance or dress"

* Other reason/none of the above

gen r_insult_other = .
replace r_insult_other = 1 if resinsulted96_1==1 | resinsulted96_2==1 | resinsulted96_3==1 | resinsulted96_4==1 | resinsulted96_5==1 | resinsulted96_6==1 | resinsulted96_7==1 | resinsulted96_8==1 | resinsulted96_9==1 | resinsulted96_10==1 | resinsulted96_11==1 | resinsulted96_12==1
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_1==0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_2==0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_3==0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_4==0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_5==0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_6==0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_7==0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_8==0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_9==0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_10==0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_11==0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted96_12==0

replace r_insult_other = 0 if (r_insult_other!=1 | r_insult_other!=0) & insulted_anywhere==0
replace r_insult_other = -8 if (r_insult_other!=1 | r_insult_other!=0) & insulted_anywhere==-8

label values r_insult_other r_
label variable r_insult_other "Reason insulted: other reason/none of the above"

replace r_insult_other = 1 if (resinsulted97_1==1 | resinsulted97_2==1 | resinsulted97_3==1 | resinsulted97_4==1 | resinsulted97_5==1 | resinsulted97_6==1 | resinsulted97_7==1 | resinsulted97_8==1 | resinsulted97_9==1 | resinsulted97_10==1 | resinsulted97_11==1 | resinsulted97_12==1) & r_insult_other!=1
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_1==0 & r_insult_other!=0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_2==0 & r_insult_other!=0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_3==0 & r_insult_other!=0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_4==0 & r_insult_other!=0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_5==0 & r_insult_other!=0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_6==0 & r_insult_other!=0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_7==0 & r_insult_other!=0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_8==0 & r_insult_other!=0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_9==0 & r_insult_other!=0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_10==0 & r_insult_other!=0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_11==0 & r_insult_other!=0
replace r_insult_other = 0 if r_insult_other!=1 & resinsulted97_12==0 & r_insult_other!=0

***
*** Measures of WHY people were INSULTED in particular places
***

* SCHOOL

gen rp_insult_schl_sex = 2 if resinsulted1_1==1 & insulted1==1
replace rp_insult_schl_sex = 1 if resinsulted1_1==0 & insulted1==1
replace rp_insult_schl_sex = 0 if insulted1==0
replace rp_insult_schl_sex = -1 if insulted1==-1
replace rp_insult_schl_sex = -8 if insulted1==-8
label define rp_insult_schl_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: school" 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_schl_sex rp_insult_schl_sex
label variable rp_insult_schl_sex "insulted - school; sex"

gen rp_insult_schl_age = 2 if resinsulted2_1==1 & insulted1==1
replace rp_insult_schl_age = 1 if resinsulted2_1==0 & insulted1==1
replace rp_insult_schl_age =0 if insulted1==0
replace rp_insult_schl_age = -1 if insulted1==-1
replace rp_insult_schl_age = -8 if insulted1==-8
label define rp_insult_schl_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: school" 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_schl_age rp_insult_schl_age
label variable rp_insult_schl_age "insulted - school; age"

gen rp_insult_schl_eth = 2 if resinsulted3_1==1 & insulted1==1
replace rp_insult_schl_eth = 1 if resinsulted3_1==0 & insulted1==1
replace rp_insult_schl_eth =0 if insulted1==0
replace rp_insult_schl_eth = -1 if insulted1==-1
replace rp_insult_schl_eth = -8 if insulted1==-8
label define rp_insult_schl_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: school" 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_schl_eth rp_insult_schl_eth
label variable rp_insult_schl_eth "insulted - school; ethnicity"

gen rp_insult_schl_sexor = 2 if resinsulted4_1==1 & insulted1==1
replace rp_insult_schl_sexor = 1 if resinsulted4_1==0 & insulted1==1
replace rp_insult_schl_sexor =0 if insulted1==0
replace rp_insult_schl_sexor = -1 if insulted1==-1
replace rp_insult_schl_sexor = -8 if insulted1==-8
label define rp_insult_schl_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: school" 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_schl_sexor rp_insult_schl_sexor
label variable rp_insult_schl_sexor "insulted - school; sexual orientation"

gen rp_insult_schl_hlth = 2 if resinsulted5_1==1 & insulted1==1
replace rp_insult_schl_hlth = 1 if resinsulted5_1==0 & insulted1==1
replace rp_insult_schl_hlth =0 if insulted1==0
replace rp_insult_schl_hlth = -1 if insulted1==-1
replace rp_insult_schl_hlth = -8 if insulted1==-8
label define rp_insult_schl_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: school" 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_schl_hlth rp_insult_schl_hlth
label variable rp_insult_schl_hlth "insulted - school; health and disability"

gen rp_insult_schl_nat = 2 if resinsulted6_1==1 & insulted1==1
replace rp_insult_schl_nat = 1 if resinsulted6_1==0 & insulted1==1
replace rp_insult_schl_nat =0 if insulted1==0
replace rp_insult_schl_nat = -1 if insulted1==-1
replace rp_insult_schl_nat = -8 if insulted1==-8
label define rp_insult_schl_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: school" 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_schl_nat rp_insult_schl_nat
label variable rp_insult_schl_nat "insulted - school; nationality"

gen rp_insult_schl_rel = 2 if resinsulted7_1==1 & insulted1==1
replace rp_insult_schl_rel = 1 if resinsulted7_1==0 & insulted1==1
replace rp_insult_schl_rel =0 if insulted1==0
replace rp_insult_schl_rel = -1 if insulted1==-1
replace rp_insult_schl_rel = -8 if insulted1==-8
label define rp_insult_schl_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: school" 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_schl_rel rp_insult_schl_rel
label variable rp_insult_schl_rel "insulted - school; religion"

gen rp_insult_schl_lang = 2 if resinsulted8_1==1 & insulted1==1
replace rp_insult_schl_lang = 1 if resinsulted8_1==0 & insulted1==1
replace rp_insult_schl_lang =0 if insulted1==0
replace rp_insult_schl_lang = -1 if insulted1==-1
replace rp_insult_schl_lang = -8 if insulted1==-8
label define rp_insult_schl_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: school" 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_schl_lang rp_insult_schl_lang
label variable rp_insult_schl_lang "insulted - school; language or accent"

gen rp_insult_schl_drss = 2 if resinsulted9_1==1 & insulted1==1
replace rp_insult_schl_drss = 1 if resinsulted9_1==0 & insulted1==1
replace rp_insult_schl_drss =0 if insulted1==0
replace rp_insult_schl_drss = -1 if insulted1==-1
replace rp_insult_schl_drss = -8 if insulted1==-8
label define rp_insult_schl_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: school" 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_schl_drss rp_insult_schl_drss
label variable rp_insult_schl_drss "insulted - school; appearance or dress"

gen rp_insult_schl_oth = 2 if resinsulted96_1==1 & insulted1==1
replace rp_insult_schl_oth = 1 if resinsulted96_1==0 & insulted1==1
replace rp_insult_schl_oth =0 if insulted1==0
replace rp_insult_schl_oth = -1 if insulted1==-1
replace rp_insult_schl_oth = -8 if insulted1==-8
label define rp_insult_schl_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: school" 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_schl_oth rp_insult_schl_oth
label variable rp_insult_schl_oth "insulted - school; 'other reason'"
replace rp_insult_schl_oth = 2 if resinsulted97_1==1

* In college/uni

gen rp_insult_uni_sex = 2 if resinsulted1_2==1 & insulted2==1
replace rp_insult_uni_sex = 1 if resinsulted1_2==0 & insulted2==1
replace rp_insult_uni_sex =0 if insulted2==0
replace rp_insult_uni_sex = -1 if insulted2==-1
replace rp_insult_uni_sex = -8 if insulted2==-8
label define rp_insult_uni_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: college/uni" 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_uni_sex rp_insult_uni_sex
label variable rp_insult_uni_sex "insulted - college/uni; sex"

gen rp_insult_uni_age = 2 if resinsulted2_2==1 & insulted2==1
replace rp_insult_uni_age = 1 if resinsulted2_2==0 & insulted2==1
replace rp_insult_uni_age =0 if insulted2==0
replace rp_insult_uni_age = -1 if insulted2==-1
replace rp_insult_uni_age = -8 if insulted2==-8
label define rp_insult_uni_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: college/uni" 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_uni_age rp_insult_uni_age
label variable rp_insult_uni_age "insulted - college/uni; age"

gen rp_insult_uni_eth = 2 if resinsulted3_2==1 & insulted2==1
replace rp_insult_uni_eth = 1 if resinsulted3_2==0 & insulted2==1
replace rp_insult_uni_eth =0 if insulted2==0
replace rp_insult_uni_eth = -1 if insulted2==-1
replace rp_insult_uni_eth = -8 if insulted2==-8
label define rp_insult_uni_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: college/uni" 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_uni_eth rp_insult_uni_eth
label variable rp_insult_uni_eth "insulted - college/uni; ethnicity"

gen rp_insult_uni_sexor = 2 if resinsulted4_2==1 & insulted2==1
replace rp_insult_uni_sexor = 1 if resinsulted4_2==0 & insulted2==1
replace rp_insult_uni_sexor =0 if insulted2==0
replace rp_insult_uni_sexor = -1 if insulted2==-1
replace rp_insult_uni_sexor = -8 if insulted2==-8
label define rp_insult_uni_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: college/uni" 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_uni_sexor rp_insult_uni_sexor
label variable rp_insult_uni_sexor "insulted - college/uni; sexual orientation"

gen rp_insult_uni_hlth = 2 if resinsulted5_2==1 & insulted2==1
replace rp_insult_uni_hlth = 1 if resinsulted5_2==0 & insulted2==1
replace rp_insult_uni_hlth =0 if insulted2==0
replace rp_insult_uni_hlth = -1 if insulted2==-1
replace rp_insult_uni_hlth = -8 if insulted2==-8
label define rp_insult_uni_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: college/uni" 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_uni_hlth rp_insult_uni_hlth
label variable rp_insult_uni_hlth "insulted - college/uni; health and disability"

gen rp_insult_uni_nat = 2 if resinsulted6_2==1 & insulted2==1
replace rp_insult_uni_nat = 1 if resinsulted6_2==0 & insulted2==1
replace rp_insult_uni_nat =0 if insulted2==0
replace rp_insult_uni_nat = -1 if insulted2==-1
replace rp_insult_uni_nat = -8 if insulted2==-8
label define rp_insult_uni_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: college/uni" 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_uni_nat rp_insult_uni_nat
label variable rp_insult_uni_nat "insulted - college/uni; nationality"

gen rp_insult_uni_rel = 2 if resinsulted7_2==1 & insulted2==1
replace rp_insult_uni_rel = 1 if resinsulted7_2==0 & insulted2==1
replace rp_insult_uni_rel =0 if insulted2==0
replace rp_insult_uni_rel = -1 if insulted2==-1
replace rp_insult_uni_rel = -8 if insulted2==-8
label define rp_insult_uni_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: college/uni" 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_uni_rel rp_insult_uni_rel
label variable rp_insult_uni_rel "insulted - college/uni; religion"

gen rp_insult_uni_lang = 2 if resinsulted8_2==1 & insulted2==1
replace rp_insult_uni_lang = 1 if resinsulted8_2==0 & insulted2==1
replace rp_insult_uni_lang =0 if insulted2==0
replace rp_insult_uni_lang = -1 if insulted2==-1
replace rp_insult_uni_lang = -8 if insulted2==-8
label define rp_insult_uni_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: college/uni" 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_uni_lang rp_insult_uni_lang
label variable rp_insult_uni_lang "insulted - college/uni; language or accent"

gen rp_insult_uni_drss = 2 if resinsulted9_2==1 & insulted2==1
replace rp_insult_uni_drss = 1 if resinsulted9_2==0 & insulted2==1
replace rp_insult_uni_drss =0 if insulted2==0
replace rp_insult_uni_drss = -1 if insulted2==-1
replace rp_insult_uni_drss = -8 if insulted2==-8
label define rp_insult_uni_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: college/uni" 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_uni_drss rp_insult_uni_drss
label variable rp_insult_uni_drss "insulted - college/uni; appearance or dress"

gen rp_insult_uni_oth = 2 if resinsulted96_2==1 & insulted2==1
replace rp_insult_uni_oth = 1 if resinsulted96_2==0 & insulted2==1
replace rp_insult_uni_oth =0 if insulted2==0
replace rp_insult_uni_oth = -1 if insulted2==-1
replace rp_insult_uni_oth = -8 if insulted2==-8
label define rp_insult_uni_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: college/uni" 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_uni_oth rp_insult_uni_oth
label variable rp_insult_uni_oth "insulted - college/uni; 'other reason'"
replace rp_insult_uni_oth = 2 if resinsulted97_2==1

* Work

gen rp_insult_wrk_sex = 2 if resinsulted1_3==1 & insulted3==1
replace rp_insult_wrk_sex = 1 if resinsulted1_3==0 & insulted3==1
replace rp_insult_wrk_sex =0 if insulted3==0
replace rp_insult_wrk_sex = -1 if insulted3==-1
replace rp_insult_wrk_sex = -8 if insulted3==-8
label define rp_insult_wrk_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: work" 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_wrk_sex rp_insult_wrk_sex
label variable rp_insult_wrk_sex "insulted - work; sex"

gen rp_insult_wrk_age = 2 if resinsulted2_3==1 & insulted3==1
replace rp_insult_wrk_age = 1 if resinsulted2_3==0 & insulted3==1
replace rp_insult_wrk_age =0 if insulted3==0
replace rp_insult_wrk_age = -1 if insulted3==-1
replace rp_insult_wrk_age = -8 if insulted3==-8
label define rp_insult_wrk_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: work" 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_wrk_age rp_insult_wrk_age
label variable rp_insult_wrk_age "insulted - work; age"

gen rp_insult_wrk_eth = 2 if resinsulted3_3==1 & insulted3==1
replace rp_insult_wrk_eth = 1 if resinsulted3_3==0 & insulted3==1
replace rp_insult_wrk_eth =0 if insulted3==0
replace rp_insult_wrk_eth = -1 if insulted3==-1
replace rp_insult_wrk_eth = -8 if insulted3==-8
label define rp_insult_wrk_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: work" 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_wrk_eth rp_insult_wrk_eth
label variable rp_insult_wrk_eth "insulted - work; ethnicity"

gen rp_insult_wrk_sexor = 2 if resinsulted4_3==1 & insulted3==1
replace rp_insult_wrk_sexor = 1 if resinsulted4_3==0 & insulted3==1
replace rp_insult_wrk_sexor =0 if insulted3==0
replace rp_insult_wrk_sexor = -1 if insulted3==-1
replace rp_insult_wrk_sexor = -8 if insulted3==-8
label define rp_insult_wrk_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: work" 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_wrk_sexor rp_insult_wrk_sexor
label variable rp_insult_wrk_sexor "insulted - work; sexual orientation"

gen rp_insult_wrk_hlth = 2 if resinsulted5_3==1 & insulted3==1
replace rp_insult_wrk_hlth = 1 if resinsulted5_3==0 & insulted3==1
replace rp_insult_wrk_hlth =0 if insulted3==0
replace rp_insult_wrk_hlth = -1 if insulted3==-1
replace rp_insult_wrk_hlth = -8 if insulted3==-8
label define rp_insult_wrk_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: work" 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_wrk_hlth rp_insult_wrk_hlth
label variable rp_insult_wrk_hlth "insulted - work; health and disability"

gen rp_insult_wrk_nat = 2 if resinsulted6_3==1 & insulted3==1
replace rp_insult_wrk_nat = 1 if resinsulted6_3==0 & insulted3==1
replace rp_insult_wrk_nat =0 if insulted3==0
replace rp_insult_wrk_nat = -1 if insulted3==-1
replace rp_insult_wrk_nat = -8 if insulted3==-8
label define rp_insult_wrk_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: work" 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_wrk_nat rp_insult_wrk_nat
label variable rp_insult_wrk_nat "insulted - work; nationality"

gen rp_insult_wrk_rel = 2 if resinsulted7_3==1 & insulted3==1
replace rp_insult_wrk_rel = 1 if resinsulted7_3==0 & insulted3==1
replace rp_insult_wrk_rel =0 if insulted3==0
replace rp_insult_wrk_rel = -1 if insulted3==-1
replace rp_insult_wrk_rel = -8 if insulted3==-8
label define rp_insult_wrk_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: work" 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_wrk_rel rp_insult_wrk_rel
label variable rp_insult_wrk_rel "insulted - work; religion"

gen rp_insult_wrk_lang = 2 if resinsulted8_3==1 & insulted3==1
replace rp_insult_wrk_lang = 1 if resinsulted8_3==0 & insulted3==1
replace rp_insult_wrk_lang =0 if insulted3==0
replace rp_insult_wrk_lang = -1 if insulted3==-1
replace rp_insult_wrk_lang = -8 if insulted3==-8
label define rp_insult_wrk_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: work" 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_wrk_lang rp_insult_wrk_lang
label variable rp_insult_wrk_lang "insulted - work; language or accent"

gen rp_insult_wrk_drss = 2 if resinsulted9_3==1 & insulted3==1
replace rp_insult_wrk_drss = 1 if resinsulted9_3==0 & insulted3==1
replace rp_insult_wrk_drss =0 if insulted3==0
replace rp_insult_wrk_drss = -1 if insulted3==-1
replace rp_insult_wrk_drss = -8 if insulted3==-8
label define rp_insult_wrk_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: work" 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_wrk_drss rp_insult_wrk_drss
label variable rp_insult_wrk_drss "insulted - work; appearance or dress"

gen rp_insult_wrk_oth = 2 if resinsulted96_3==1 & insulted3==1
replace rp_insult_wrk_oth = 1 if resinsulted96_3==0 & insulted3==1
replace rp_insult_wrk_oth =0 if insulted3==0
replace rp_insult_wrk_oth = -1 if insulted3==-1
replace rp_insult_wrk_oth = -8 if insulted3==-8
label define rp_insult_wrk_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: work" 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_wrk_oth rp_insult_wrk_oth
label variable rp_insult_wrk_oth "insulted - work; 'other reason'"
replace rp_insult_wrk_oth = 2 if resinsulted97_3==1

* Public Transportation

gen rp_insult_ptran_sex = 2 if resinsulted1_4==1 & insulted4==1
replace rp_insult_ptran_sex = 1 if resinsulted1_4==0 & insulted4==1
replace rp_insult_ptran_sex =0 if insulted4==0
replace rp_insult_ptran_sex = -1 if insulted4==-1
replace rp_insult_ptran_sex = -8 if insulted4==-8
label define rp_insult_ptran_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pub. trans." 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_ptran_sex rp_insult_ptran_sex
label variable rp_insult_ptran_sex "insulted - public transportation; sex"

gen rp_insult_ptran_age = 2 if resinsulted2_4==1 & insulted4==1
replace rp_insult_ptran_age = 1 if resinsulted2_4==0 & insulted4==1
replace rp_insult_ptran_age =0 if insulted4==0
replace rp_insult_ptran_age = -1 if insulted4==-1
replace rp_insult_ptran_age = -8 if insulted4==-8
label define rp_insult_ptran_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pub. trans." 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_ptran_age rp_insult_ptran_age
label variable rp_insult_ptran_age "insulted - public transportation; age"

gen rp_insult_ptran_eth = 2 if resinsulted3_4==1 & insulted4==1
replace rp_insult_ptran_eth = 1 if resinsulted3_4==0 & insulted4==1
replace rp_insult_ptran_eth =0 if insulted4==0
replace rp_insult_ptran_eth = -1 if insulted4==-1
replace rp_insult_ptran_eth = -8 if insulted4==-8
label define rp_insult_ptran_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pub. trans." 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_ptran_eth rp_insult_ptran_eth
label variable rp_insult_ptran_eth "insulted - public transportation; ethnicity"

gen rp_insult_ptran_sexor = 2 if resinsulted4_4==1 & insulted4==1
replace rp_insult_ptran_sexor = 1 if resinsulted4_4==0 & insulted4==1
replace rp_insult_ptran_sexor =0 if insulted4==0
replace rp_insult_ptran_sexor = -1 if insulted4==-1
replace rp_insult_ptran_sexor = -8 if insulted4==-8
label define rp_insult_ptran_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pub. trans." 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_ptran_sexor rp_insult_ptran_sexor
label variable rp_insult_ptran_sexor "insulted - public transportation; sexual orientation"

gen rp_insult_ptran_hlth = 2 if resinsulted5_4==1 & insulted4==1
replace rp_insult_ptran_hlth = 1 if resinsulted5_4==0 & insulted4==1
replace rp_insult_ptran_hlth =0 if insulted4==0
replace rp_insult_ptran_hlth = -1 if insulted4==-1
replace rp_insult_ptran_hlth = -8 if insulted4==-8
label define rp_insult_ptran_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pub. trans." 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_ptran_hlth rp_insult_ptran_hlth
label variable rp_insult_ptran_hlth "insulted - public transportation; health and disability"

gen rp_insult_ptran_nat = 2 if resinsulted6_4==1 & insulted4==1
replace rp_insult_ptran_nat = 1 if resinsulted6_4==0 & insulted4==1
replace rp_insult_ptran_nat =0 if insulted4==0
replace rp_insult_ptran_nat = -1 if insulted4==-1
replace rp_insult_ptran_nat = -8 if insulted4==-8
label define rp_insult_ptran_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pub. trans." 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_ptran_nat rp_insult_ptran_nat
label variable rp_insult_ptran_nat "insulted - public transportation; nationality"

gen rp_insult_ptran_rel = 2 if resinsulted7_4==1 & insulted4==1
replace rp_insult_ptran_rel = 1 if resinsulted7_4==0 & insulted4==1
replace rp_insult_ptran_rel =0 if insulted4==0
replace rp_insult_ptran_rel = -1 if insulted4==-1
replace rp_insult_ptran_rel = -8 if insulted4==-8
label define rp_insult_ptran_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pub. trans." 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_ptran_rel rp_insult_ptran_rel
label variable rp_insult_ptran_rel "insulted - public transportation; religion"

gen rp_insult_ptran_lang = 2 if resinsulted8_4==1 & insulted4==1
replace rp_insult_ptran_lang = 1 if resinsulted8_4==0 & insulted4==1
replace rp_insult_ptran_lang =0 if insulted4==0
replace rp_insult_ptran_lang = -1 if insulted4==-1
replace rp_insult_ptran_lang = -8 if insulted4==-8
label define rp_insult_ptran_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pub. trans." 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_ptran_lang rp_insult_ptran_lang
label variable rp_insult_ptran_lang "insulted - public transportation; language or accent"

gen rp_insult_ptran_drss = 2 if resinsulted9_4==1 & insulted4==1
replace rp_insult_ptran_drss = 1 if resinsulted9_4==0 & insulted4==1
replace rp_insult_ptran_drss =0 if insulted4==0
replace rp_insult_ptran_drss = -1 if insulted4==-1
replace rp_insult_ptran_drss = -8 if insulted4==-8
label define rp_insult_ptran_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pub. trans." 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_ptran_drss rp_insult_ptran_drss
label variable rp_insult_ptran_drss "insulted - public transportation; appearance or dress"

gen rp_insult_ptran_oth = 2 if resinsulted96_4==1 & insulted4==1
replace rp_insult_ptran_oth = 1 if resinsulted96_4==0 & insulted4==1
replace rp_insult_ptran_oth =0 if insulted4==0
replace rp_insult_ptran_oth = -1 if insulted4==-1
replace rp_insult_ptran_oth = -8 if insulted4==-8
label define rp_insult_ptran_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pub. trans." 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_ptran_oth rp_insult_ptran_oth
label variable rp_insult_ptran_oth "insulted - public transportation	; 'other reason'"
replace rp_insult_ptran_oth = 2 if resinsulted97_4==1

* Bus/Train Station

gen rp_insult_btstn_sex = 2 if resinsulted1_5==1 & insulted5==1
replace rp_insult_btstn_sex = 1 if resinsulted1_5==0 & insulted5==1
replace rp_insult_btstn_sex =0 if insulted5==0
replace rp_insult_btstn_sex = -1 if insulted5==-1
replace rp_insult_btstn_sex = -8 if insulted5==-8
label define rp_insult_btstn_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: stations" 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_btstn_sex rp_insult_btstn_sex
label variable rp_insult_btstn_sex "insulted - bus/train stations; sex"

gen rp_insult_btstn_age = 2 if resinsulted2_5==1 & insulted5==1
replace rp_insult_btstn_age = 1 if resinsulted2_5==0 & insulted5==1
replace rp_insult_btstn_age =0 if insulted5==0
replace rp_insult_btstn_age = -1 if insulted5==-1
replace rp_insult_btstn_age = -8 if insulted5==-8
label define rp_insult_btstn_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: stations" 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_btstn_age rp_insult_btstn_age
label variable rp_insult_btstn_age "insulted - bus/train stations; age"

gen rp_insult_btstn_eth = 2 if resinsulted3_5==1 & insulted5==1
replace rp_insult_btstn_eth = 1 if resinsulted3_5==0 & insulted5==1
replace rp_insult_btstn_eth =0 if insulted5==0
replace rp_insult_btstn_eth = -1 if insulted5==-1
replace rp_insult_btstn_eth = -8 if insulted5==-8
label define rp_insult_btstn_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: stations" 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_btstn_eth rp_insult_btstn_eth
label variable rp_insult_btstn_eth "insulted - bus/train stations; ethnicity"

gen rp_insult_btstn_sexor = 2 if resinsulted4_5==1 & insulted5==1
replace rp_insult_btstn_sexor = 1 if resinsulted4_5==0 & insulted5==1
replace rp_insult_btstn_sexor =0 if insulted5==0
replace rp_insult_btstn_sexor = -1 if insulted5==-1
replace rp_insult_btstn_sexor = -8 if insulted5==-8
label define rp_insult_btstn_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: stations" 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_btstn_sexor rp_insult_btstn_sexor
label variable rp_insult_btstn_sexor "insulted - bus/train stations; sexual orientation"

gen rp_insult_btstn_hlth = 2 if resinsulted5_5==1 & insulted5==1
replace rp_insult_btstn_hlth = 1 if resinsulted5_5==0 & insulted5==1
replace rp_insult_btstn_hlth =0 if insulted5==0
replace rp_insult_btstn_hlth = -1 if insulted5==-1
replace rp_insult_btstn_hlth = -8 if insulted5==-8
label define rp_insult_btstn_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: stations" 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_btstn_hlth rp_insult_btstn_hlth
label variable rp_insult_btstn_hlth "insulted - bus/train stations; health and disability"

gen rp_insult_btstn_nat = 2 if resinsulted6_5==1 & insulted5==1
replace rp_insult_btstn_nat = 1 if resinsulted6_5==0 & insulted5==1
replace rp_insult_btstn_nat =0 if insulted5==0
replace rp_insult_btstn_nat = -1 if insulted5==-1
replace rp_insult_btstn_nat = -8 if insulted5==-8
label define rp_insult_btstn_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: stations" 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_btstn_nat rp_insult_btstn_nat
label variable rp_insult_btstn_nat "insulted - bus/train stations; nationality"

gen rp_insult_btstn_rel = 2 if resinsulted7_5==1 & insulted5==1
replace rp_insult_btstn_rel = 1 if resinsulted7_5==0 & insulted5==1
replace rp_insult_btstn_rel =0 if insulted5==0
replace rp_insult_btstn_rel = -1 if insulted5==-1
replace rp_insult_btstn_rel = -8 if insulted5==-8
label define rp_insult_btstn_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: stations" 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_btstn_rel rp_insult_btstn_rel
label variable rp_insult_btstn_rel "insulted - bus/train stations; religion"

gen rp_insult_btstn_lang = 2 if resinsulted8_5==1 & insulted5==1
replace rp_insult_btstn_lang = 1 if resinsulted8_5==0 & insulted5==1
replace rp_insult_btstn_lang =0 if insulted5==0
replace rp_insult_btstn_lang = -1 if insulted5==-1
replace rp_insult_btstn_lang = -8 if insulted5==-8
label define rp_insult_btstn_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: stations" 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_btstn_lang rp_insult_btstn_lang
label variable rp_insult_btstn_lang "insulted - bus/train stations; language or accent"

gen rp_insult_btstn_drss = 2 if resinsulted9_5==1 & insulted5==1
replace rp_insult_btstn_drss = 1 if resinsulted9_5==0 & insulted5==1
replace rp_insult_btstn_drss =0 if insulted5==0
replace rp_insult_btstn_drss = -1 if insulted5==-1
replace rp_insult_btstn_drss = -8 if insulted5==-8
label define rp_insult_btstn_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: stations" 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_btstn_drss rp_insult_btstn_drss
label variable rp_insult_btstn_drss "insulted - bus/train stations; appearance or dress"

gen rp_insult_btstn_oth = 2 if resinsulted96_5==1 & insulted5==1
replace rp_insult_btstn_oth = 1 if resinsulted96_5==0 & insulted5==1
replace rp_insult_btstn_oth =0 if insulted5==0
replace rp_insult_btstn_oth = -1 if insulted5==-1
replace rp_insult_btstn_oth = -8 if insulted5==-8
label define rp_insult_btstn_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: stations" 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_btstn_oth rp_insult_btstn_oth
label variable rp_insult_btstn_oth "insulted - bus/train stations; 'other reason'"
replace rp_insult_btstn_oth = 2 if resinsulted97_5==1

* Shopping centres

gen rp_insult_shpc_sex = 2 if resinsulted1_6==1 & insulted6==1
replace rp_insult_shpc_sex = 1 if resinsulted1_6==0 & insulted6==1
replace rp_insult_shpc_sex =0 if insulted6==0
replace rp_insult_shpc_sex = -1 if insulted6==-1
replace rp_insult_shpc_sex = -8 if insulted6==-8
label define rp_insult_shpc_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: shopping, etc." 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_shpc_sex rp_insult_shpc_sex
label variable rp_insult_shpc_sex "insulted - shopping places; sex"

gen rp_insult_shpc_age = 2 if resinsulted2_6==1 & insulted6==1
replace rp_insult_shpc_age = 1 if resinsulted2_6==0 & insulted6==1
replace rp_insult_shpc_age =0 if insulted6==0
replace rp_insult_shpc_age = -1 if insulted6==-1
replace rp_insult_shpc_age = -8 if insulted6==-8
label define rp_insult_shpc_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: shopping, etc." 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_shpc_age rp_insult_shpc_age
label variable rp_insult_shpc_age "insulted - shopping places; age"

gen rp_insult_shpc_eth = 2 if resinsulted3_6==1 & insulted6==1
replace rp_insult_shpc_eth = 1 if resinsulted3_6==0 & insulted6==1
replace rp_insult_shpc_eth =0 if insulted6==0
replace rp_insult_shpc_eth = -1 if insulted6==-1
replace rp_insult_shpc_eth = -8 if insulted6==-8
label define rp_insult_shpc_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: shopping, etc." 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_shpc_eth rp_insult_shpc_eth
label variable rp_insult_shpc_eth "insulted - shopping places; ethnicity"

gen rp_insult_shpc_sexor = 2 if resinsulted4_6==1 & insulted6==1
replace rp_insult_shpc_sexor = 1 if resinsulted4_6==0 & insulted6==1
replace rp_insult_shpc_sexor =0 if insulted6==0
replace rp_insult_shpc_sexor = -1 if insulted6==-1
replace rp_insult_shpc_sexor = -8 if insulted6==-8
label define rp_insult_shpc_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: shopping, etc." 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_shpc_sexor rp_insult_shpc_sexor
label variable rp_insult_shpc_sexor "insulted - shopping places; sexual orientation"

gen rp_insult_shpc_hlth = 2 if resinsulted5_6==1 & insulted6==1
replace rp_insult_shpc_hlth = 1 if resinsulted5_6==0 & insulted6==1
replace rp_insult_shpc_hlth =0 if insulted6==0
replace rp_insult_shpc_hlth = -1 if insulted6==-1
replace rp_insult_shpc_hlth = -8 if insulted6==-8
label define rp_insult_shpc_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: shopping, etc." 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_shpc_hlth rp_insult_shpc_hlth
label variable rp_insult_shpc_hlth "insulted - shopping places; health and disability"

gen rp_insult_shpc_nat = 2 if resinsulted6_6==1 & insulted6==1
replace rp_insult_shpc_nat = 1 if resinsulted6_6==0 & insulted6==1
replace rp_insult_shpc_nat =0 if insulted6==0
replace rp_insult_shpc_nat = -1 if insulted6==-1
replace rp_insult_shpc_nat = -8 if insulted6==-8
label define rp_insult_shpc_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: shopping, etc." 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_shpc_nat rp_insult_shpc_nat
label variable rp_insult_shpc_nat "insulted - shopping places; nationality"

gen rp_insult_shpc_rel = 2 if resinsulted7_6==1 & insulted6==1
replace rp_insult_shpc_rel = 1 if resinsulted7_6==0 & insulted6==1
replace rp_insult_shpc_rel =0 if insulted6==0
replace rp_insult_shpc_rel = -1 if insulted6==-1
replace rp_insult_shpc_rel = -8 if insulted6==-8
label define rp_insult_shpc_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: shopping, etc." 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_shpc_rel rp_insult_shpc_rel
label variable rp_insult_shpc_rel "insulted - shopping places; religion"

gen rp_insult_shpc_lang = 2 if resinsulted8_6==1 & insulted6==1
replace rp_insult_shpc_lang = 1 if resinsulted8_6==0 & insulted6==1
replace rp_insult_shpc_lang =0 if insulted6==0
replace rp_insult_shpc_lang = -1 if insulted6==-1
replace rp_insult_shpc_lang = -8 if insulted6==-8
label define rp_insult_shpc_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: shopping, etc." 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_shpc_lang rp_insult_shpc_lang
label variable rp_insult_shpc_lang "insulted - shopping places; language or accent"

gen rp_insult_shpc_drss = 2 if resinsulted9_6==1 & insulted6==1
replace rp_insult_shpc_drss = 1 if resinsulted9_6==0 & insulted6==1
replace rp_insult_shpc_drss =0 if insulted6==0
replace rp_insult_shpc_drss = -1 if insulted6==-1
replace rp_insult_shpc_drss = -8 if insulted6==-8
label define rp_insult_shpc_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: shopping, etc." 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_shpc_drss rp_insult_shpc_drss
label variable rp_insult_shpc_drss "insulted - shopping places; appearance or dress"

gen rp_insult_shpc_oth = 2 if resinsulted96_6==1 & insulted6==1
replace rp_insult_shpc_oth = 1 if resinsulted96_6==0 & insulted6==1
replace rp_insult_shpc_oth =0 if insulted6==0
replace rp_insult_shpc_oth = -1 if insulted6==-1
replace rp_insult_shpc_oth = -8 if insulted6==-8
label define rp_insult_shpc_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: shopping, etc." 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_shpc_oth rp_insult_shpc_oth
label variable rp_insult_shpc_oth "insulted - shopping places; 'other reason'"
replace rp_insult_shpc_oth = 2 if resinsulted97_6==1

* In cinema, cafes, etc

gen rp_insult_cincf_sex = 2 if resinsulted1_7==1 & insulted7==1
replace rp_insult_cincf_sex = 1 if resinsulted1_7==0 & insulted7==1
replace rp_insult_cincf_sex =0 if insulted7==0
replace rp_insult_cincf_sex = -1 if insulted7==-1
replace rp_insult_cincf_sex = -8 if insulted7==-8
label define rp_insult_cincf_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: cinemas, cafes, etc." 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_cincf_sex rp_insult_cincf_sex
label variable rp_insult_cincf_sex "insulted - cinema, cafes, etc.; sex"

gen rp_insult_cincf_age = 2 if resinsulted2_7==1 & insulted7==1
replace rp_insult_cincf_age = 1 if resinsulted2_7==0 & insulted7==1
replace rp_insult_cincf_age =0 if insulted7==0
replace rp_insult_cincf_age = -1 if insulted7==-1
replace rp_insult_cincf_age = -8 if insulted7==-8
label define rp_insult_cincf_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: cinemas, cafes, etc." 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_cincf_age rp_insult_cincf_age
label variable rp_insult_cincf_age "insulted - cinema, cafes, etc.; age"

gen rp_insult_cincf_eth = 2 if resinsulted3_7==1 & insulted7==1
replace rp_insult_cincf_eth = 1 if resinsulted3_7==0 & insulted7==1
replace rp_insult_cincf_eth =0 if insulted7==0
replace rp_insult_cincf_eth = -1 if insulted7==-1
replace rp_insult_cincf_eth = -8 if insulted7==-8
label define rp_insult_cincf_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: cinemas, cafes, etc." 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_cincf_eth rp_insult_cincf_eth
label variable rp_insult_cincf_eth "insulted - cinema, cafes, etc.; ethnicity"

gen rp_insult_cincf_sexor = 2 if resinsulted4_7==1 & insulted7==1
replace rp_insult_cincf_sexor = 1 if resinsulted4_7==0 & insulted7==1
replace rp_insult_cincf_sexor =0 if insulted7==0
replace rp_insult_cincf_sexor = -1 if insulted7==-1
replace rp_insult_cincf_sexor = -8 if insulted7==-8
label define rp_insult_cincf_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: cinemas, cafes, etc." 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_cincf_sexor rp_insult_cincf_sexor
label variable rp_insult_cincf_sexor "insulted - cinema, cafes, etc.; sexual orientation"

gen rp_insult_cincf_hlth = 2 if resinsulted5_7==1 & insulted7==1
replace rp_insult_cincf_hlth = 1 if resinsulted5_7==0 & insulted7==1
replace rp_insult_cincf_hlth =0 if insulted7==0
replace rp_insult_cincf_hlth = -1 if insulted7==-1
replace rp_insult_cincf_hlth = -8 if insulted7==-8
label define rp_insult_cincf_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: cinemas, cafes, etc." 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_cincf_hlth rp_insult_cincf_hlth
label variable rp_insult_cincf_hlth "insulted - cinema, cafes, etc.; health and disability"

gen rp_insult_cincf_nat = 2 if resinsulted6_7==1 & insulted7==1
replace rp_insult_cincf_nat = 1 if resinsulted6_7==0 & insulted7==1
replace rp_insult_cincf_nat =0 if insulted7==0
replace rp_insult_cincf_nat = -1 if insulted7==-1
replace rp_insult_cincf_nat = -8 if insulted7==-8
label define rp_insult_cincf_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: cinemas, cafes, etc." 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_cincf_nat rp_insult_cincf_nat
label variable rp_insult_cincf_nat "insulted - cinema, cafes, etc.; nationality"

gen rp_insult_cincf_rel = 2 if resinsulted7_7==1 & insulted7==1
replace rp_insult_cincf_rel = 1 if resinsulted7_7==0 & insulted7==1
replace rp_insult_cincf_rel =0 if insulted7==0
replace rp_insult_cincf_rel = -1 if insulted7==-1
replace rp_insult_cincf_rel = -8 if insulted7==-8
label define rp_insult_cincf_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: cinemas, cafes, etc." 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_cincf_rel rp_insult_cincf_rel
label variable rp_insult_cincf_rel "insulted - cinema, cafes, etc.; religion"

gen rp_insult_cincf_lang = 2 if resinsulted8_7==1 & insulted7==1
replace rp_insult_cincf_lang = 1 if resinsulted8_7==0 & insulted7==1
replace rp_insult_cincf_lang =0 if insulted7==0
replace rp_insult_cincf_lang = -1 if insulted7==-1
replace rp_insult_cincf_lang = -8 if insulted7==-8
label define rp_insult_cincf_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: cinemas, cafes, etc." 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_cincf_lang rp_insult_cincf_lang
label variable rp_insult_cincf_lang "insulted - cinema, cafes, etc.; language or accent"

gen rp_insult_cincf_drss = 2 if resinsulted9_7==1 & insulted7==1
replace rp_insult_cincf_drss = 1 if resinsulted9_7==0 & insulted7==1
replace rp_insult_cincf_drss =0 if insulted7==0
replace rp_insult_cincf_drss = -1 if insulted7==-1
replace rp_insult_cincf_drss = -8 if insulted7==-8
label define rp_insult_cincf_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: cinemas, cafes, etc." 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_cincf_drss rp_insult_cincf_drss
label variable rp_insult_cincf_drss "insulted - cinema, cafes, etc.; appearance or dress"

gen rp_insult_cincf_oth = 2 if resinsulted96_7==1 & insulted7==1
replace rp_insult_cincf_oth = 1 if resinsulted96_7==0 & insulted7==1
replace rp_insult_cincf_oth =0 if insulted7==0
replace rp_insult_cincf_oth = -1 if insulted7==-1
replace rp_insult_cincf_oth = -8 if insulted7==-8
label define rp_insult_cincf_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: cinemas, cafes, etc." 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_cincf_oth rp_insult_cincf_oth
label variable rp_insult_cincf_oth "insulted - cinema, cafes, etc.; 'other reason'"
replace rp_insult_cincf_oth = 2 if resinsulted97_7==1

* Pubs, Discos, Night Clubs, etc.

gen rp_insult_nsoc_sex = 2 if resinsulted1_8==1 & insulted8==1
replace rp_insult_nsoc_sex = 1 if resinsulted1_8==0 & insulted8==1
replace rp_insult_nsoc_sex =0 if insulted8==0
replace rp_insult_nsoc_sex = -1 if insulted8==-1
replace rp_insult_nsoc_sex = -8 if insulted8==-8
label define rp_insult_nsoc_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pubs, clubs, etc." 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_nsoc_sex rp_insult_nsoc_sex
label variable rp_insult_nsoc_sex "insulted - Pubs, Clubs, Discos; sex"

gen rp_insult_nsoc_age = 2 if resinsulted2_8==1 & insulted8==1
replace rp_insult_nsoc_age = 1 if resinsulted2_8==0 & insulted8==1
replace rp_insult_nsoc_age =0 if insulted8==0
replace rp_insult_nsoc_age = -1 if insulted8==-1
replace rp_insult_nsoc_age = -8 if insulted8==-8
label define rp_insult_nsoc_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pubs, clubs, etc." 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_nsoc_age rp_insult_nsoc_age
label variable rp_insult_nsoc_age "insulted - Pubs, Clubs, Discos; age"

gen rp_insult_nsoc_eth = 2 if resinsulted3_8==1 & insulted8==1
replace rp_insult_nsoc_eth = 1 if resinsulted3_8==0 & insulted8==1
replace rp_insult_nsoc_eth =0 if insulted8==0
replace rp_insult_nsoc_eth = -1 if insulted8==-1
replace rp_insult_nsoc_eth = -8 if insulted8==-8
label define rp_insult_nsoc_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pubs, clubs, etc." 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_nsoc_eth rp_insult_nsoc_eth
label variable rp_insult_nsoc_eth "insulted - Pubs, Clubs, Discos; ethnicity"

gen rp_insult_nsoc_sexor = 2 if resinsulted4_8==1 & insulted8==1
replace rp_insult_nsoc_sexor = 1 if resinsulted4_8==0 & insulted8==1
replace rp_insult_nsoc_sexor =0 if insulted8==0
replace rp_insult_nsoc_sexor = -1 if insulted8==-1
replace rp_insult_nsoc_sexor = -8 if insulted8==-8
label define rp_insult_nsoc_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pubs, clubs, etc." 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_nsoc_sexor rp_insult_nsoc_sexor
label variable rp_insult_nsoc_sexor "insulted - Pubs, Clubs, Discos; sexual orientation"

gen rp_insult_nsoc_hlth = 2 if resinsulted5_8==1 & insulted8==1
replace rp_insult_nsoc_hlth = 1 if resinsulted5_8==0 & insulted8==1
replace rp_insult_nsoc_hlth =0 if insulted8==0
replace rp_insult_nsoc_hlth = -1 if insulted8==-1
replace rp_insult_nsoc_hlth = -8 if insulted8==-8
label define rp_insult_nsoc_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pubs, clubs, etc." 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_nsoc_hlth rp_insult_nsoc_hlth
label variable rp_insult_nsoc_hlth "insulted - Pubs, Clubs, Discos; health and disability"

gen rp_insult_nsoc_nat = 2 if resinsulted6_8==1 & insulted8==1
replace rp_insult_nsoc_nat = 1 if resinsulted6_8==0 & insulted8==1
replace rp_insult_nsoc_nat =0 if insulted8==0
replace rp_insult_nsoc_nat = -1 if insulted8==-1
replace rp_insult_nsoc_nat = -8 if insulted8==-8
label define rp_insult_nsoc_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pubs, clubs, etc." 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_nsoc_nat rp_insult_nsoc_nat
label variable rp_insult_nsoc_nat "insulted - Pubs, Clubs, Discos; nationality"

gen rp_insult_nsoc_rel = 2 if resinsulted7_8==1 & insulted8==1
replace rp_insult_nsoc_rel = 1 if resinsulted7_8==0 & insulted8==1
replace rp_insult_nsoc_rel =0 if insulted8==0
replace rp_insult_nsoc_rel = -1 if insulted8==-1
replace rp_insult_nsoc_rel = -8 if insulted8==-8
label define rp_insult_nsoc_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pubs, clubs, etc." 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_nsoc_rel rp_insult_nsoc_rel
label variable rp_insult_nsoc_rel "insulted - Pubs, Clubs, Discos; religion"

gen rp_insult_nsoc_lang = 2 if resinsulted8_8==1 & insulted8==1
replace rp_insult_nsoc_lang = 1 if resinsulted8_8==0 & insulted8==1
replace rp_insult_nsoc_lang =0 if insulted8==0
replace rp_insult_nsoc_lang = -1 if insulted8==-1
replace rp_insult_nsoc_lang = -8 if insulted8==-8
label define rp_insult_nsoc_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pubs, clubs, etc." 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_nsoc_lang rp_insult_nsoc_lang
label variable rp_insult_nsoc_lang "insulted - Pubs, Clubs, Discos; language or accent"

gen rp_insult_nsoc_drss = 2 if resinsulted9_8==1 & insulted8==1
replace rp_insult_nsoc_drss = 1 if resinsulted9_8==0 & insulted8==1
replace rp_insult_nsoc_drss =0 if insulted8==0
replace rp_insult_nsoc_drss = -1 if insulted8==-1
replace rp_insult_nsoc_drss = -8 if insulted8==-8
label define rp_insult_nsoc_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pubs, clubs, etc." 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_nsoc_drss rp_insult_nsoc_drss
label variable rp_insult_nsoc_drss "insulted - Pubs, Clubs, Discos; appearance or dress"

gen rp_insult_nsoc_oth = 2 if resinsulted96_8==1 & insulted8==1
replace rp_insult_nsoc_oth = 1 if resinsulted96_8==0 & insulted8==1
replace rp_insult_nsoc_oth =0 if insulted8==0
replace rp_insult_nsoc_oth = -1 if insulted8==-1
replace rp_insult_nsoc_oth = -8 if insulted8==-8
label define rp_insult_nsoc_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: pubs, clubs, etc." 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_nsoc_oth rp_insult_nsoc_oth
label variable rp_insult_nsoc_oth "insulted - Pubs, Clubs, Discos	; 'other reason'"
replace rp_insult_nsoc_oth = 2 if resinsulted97_8==1

* Car Parks

gen rp_insult_cpark_sex = 2 if resinsulted1_9==1 & insulted9==1
replace rp_insult_cpark_sex = 1 if resinsulted1_9==0 & insulted9==1
replace rp_insult_cpark_sex =0 if insulted9==0
replace rp_insult_cpark_sex = -1 if insulted9==-1
replace rp_insult_cpark_sex = -8 if insulted9==-8
label define rp_insult_cpark_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: Car parks" 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_cpark_sex rp_insult_cpark_sex
label variable rp_insult_cpark_sex "insulted - Car Parks; sex"

gen rp_insult_cpark_age = 2 if resinsulted2_9==1 & insulted9==1
replace rp_insult_cpark_age = 1 if resinsulted2_9==0 & insulted9==1
replace rp_insult_cpark_age =0 if insulted9==0
replace rp_insult_cpark_age = -1 if insulted9==-1
replace rp_insult_cpark_age = -8 if insulted9==-8
label define rp_insult_cpark_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: Car parks" 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_cpark_age rp_insult_cpark_age
label variable rp_insult_cpark_age "insulted - Car Parks; age"

gen rp_insult_cpark_eth = 2 if resinsulted3_9==1 & insulted9==1
replace rp_insult_cpark_eth = 1 if resinsulted3_9==0 & insulted9==1
replace rp_insult_cpark_eth =0 if insulted9==0
replace rp_insult_cpark_eth = -1 if insulted9==-1
replace rp_insult_cpark_eth = -8 if insulted9==-8
label define rp_insult_cpark_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: Car parks" 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_cpark_eth rp_insult_cpark_eth
label variable rp_insult_cpark_eth "insulted - Car Parks; ethnicity"

gen rp_insult_cpark_sexor = 2 if resinsulted4_9==1 & insulted9==1
replace rp_insult_cpark_sexor = 1 if resinsulted4_9==0 & insulted9==1
replace rp_insult_cpark_sexor =0 if insulted9==0
replace rp_insult_cpark_sexor = -1 if insulted9==-1
replace rp_insult_cpark_sexor = -8 if insulted9==-8
label define rp_insult_cpark_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: Car parks" 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_cpark_sexor rp_insult_cpark_sexor
label variable rp_insult_cpark_sexor "insulted - Car Parks; sexual orientation"

gen rp_insult_cpark_hlth = 2 if resinsulted5_9==1 & insulted9==1
replace rp_insult_cpark_hlth = 1 if resinsulted5_9==0 & insulted9==1
replace rp_insult_cpark_hlth =0 if insulted9==0
replace rp_insult_cpark_hlth = -1 if insulted9==-1
replace rp_insult_cpark_hlth = -8 if insulted9==-8
label define rp_insult_cpark_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: Car parks" 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_cpark_hlth rp_insult_cpark_hlth
label variable rp_insult_cpark_hlth "insulted - Car Parks; health and disability"

gen rp_insult_cpark_nat = 2 if resinsulted6_9==1 & insulted9==1
replace rp_insult_cpark_nat = 1 if resinsulted6_9==0 & insulted9==1
replace rp_insult_cpark_nat =0 if insulted9==0
replace rp_insult_cpark_nat = -1 if insulted9==-1
replace rp_insult_cpark_nat = -8 if insulted9==-8
label define rp_insult_cpark_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: Car parks" 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_cpark_nat rp_insult_cpark_nat
label variable rp_insult_cpark_nat "insulted - Car Parks; nationality"

gen rp_insult_cpark_rel = 2 if resinsulted7_9==1 & insulted9==1
replace rp_insult_cpark_rel = 1 if resinsulted7_9==0 & insulted9==1
replace rp_insult_cpark_rel =0 if insulted9==0
replace rp_insult_cpark_rel = -1 if insulted9==-1
replace rp_insult_cpark_rel = -8 if insulted9==-8
label define rp_insult_cpark_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: Car parks" 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_cpark_rel rp_insult_cpark_rel
label variable rp_insult_cpark_rel "insulted - Car Parks; religion"

gen rp_insult_cpark_lang = 2 if resinsulted8_9==1 & insulted9==1
replace rp_insult_cpark_lang = 1 if resinsulted8_9==0 & insulted9==1
replace rp_insult_cpark_lang =0 if insulted9==0
replace rp_insult_cpark_lang = -1 if insulted9==-1
replace rp_insult_cpark_lang = -8 if insulted9==-8
label define rp_insult_cpark_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: Car parks" 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_cpark_lang rp_insult_cpark_lang
label variable rp_insult_cpark_lang "insulted - Car Parks; language or accent"

gen rp_insult_cpark_drss = 2 if resinsulted9_9==1 & insulted9==1
replace rp_insult_cpark_drss = 1 if resinsulted9_9==0 & insulted9==1
replace rp_insult_cpark_drss =0 if insulted9==0
replace rp_insult_cpark_drss = -1 if insulted9==-1
replace rp_insult_cpark_drss = -8 if insulted9==-8
label define rp_insult_cpark_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: Car parks" 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_cpark_drss rp_insult_cpark_drss
label variable rp_insult_cpark_drss "insulted - Car Parks; appearance or dress"

gen rp_insult_cpark_oth = 2 if resinsulted96_9==1 & insulted9==1
replace rp_insult_cpark_oth = 1 if resinsulted96_9==0 & insulted9==1
replace rp_insult_cpark_oth =0 if insulted9==0
replace rp_insult_cpark_oth = -1 if insulted9==-1
replace rp_insult_cpark_oth = -8 if insulted9==-8
label define rp_insult_cpark_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: Car parks" 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_cpark_oth rp_insult_cpark_oth
label variable rp_insult_cpark_oth "insulted - Car Parks; 'other reason'"
replace rp_insult_cpark_oth = 2 if resinsulted97_9==1

* Outside (streets/parks)

gen rp_insult_out_sex = 2 if resinsulted1_10==1 & insulted10==1
replace rp_insult_out_sex = 1 if resinsulted1_10==0 & insulted10==1
replace rp_insult_out_sex =0 if insulted10==0
replace rp_insult_out_sex = -1 if insulted10==-1
replace rp_insult_out_sex = -8 if insulted10==-8
label define rp_insult_out_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: outside (streets, parks, etc.)" 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_out_sex rp_insult_out_sex
label variable rp_insult_out_sex "insulted - outside (streets, parks, etc.); sex"

gen rp_insult_out_age = 2 if resinsulted2_10==1 & insulted10==1
replace rp_insult_out_age = 1 if resinsulted2_10==0 & insulted10==1
replace rp_insult_out_age =0 if insulted10==0
replace rp_insult_out_age = -1 if insulted10==-1
replace rp_insult_out_age = -8 if insulted10==-8
label define rp_insult_out_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: outside (streets, parks, etc.)" 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_out_age rp_insult_out_age
label variable rp_insult_out_age "insulted - outside (streets, parks, etc.); age"

gen rp_insult_out_eth = 2 if resinsulted3_10==1 & insulted10==1
replace rp_insult_out_eth = 1 if resinsulted3_10==0 & insulted10==1
replace rp_insult_out_eth =0 if insulted10==0
replace rp_insult_out_eth = -1 if insulted10==-1
replace rp_insult_out_eth = -8 if insulted10==-8
label define rp_insult_out_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: outside (streets, parks, etc.)" 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_out_eth rp_insult_out_eth
label variable rp_insult_out_eth "insulted - outside (streets, parks, etc.); ethnicity"

gen rp_insult_out_sexor = 2 if resinsulted4_10==1 & insulted10==1
replace rp_insult_out_sexor = 1 if resinsulted4_10==0 & insulted10==1
replace rp_insult_out_sexor =0 if insulted10==0
replace rp_insult_out_sexor = -1 if insulted10==-1
replace rp_insult_out_sexor = -8 if insulted10==-8
label define rp_insult_out_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: outside (streets, parks, etc.)" 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_out_sexor rp_insult_out_sexor
label variable rp_insult_out_sexor "insulted - outside (streets, parks, etc.); sexual orientation"

gen rp_insult_out_hlth = 2 if resinsulted5_10==1 & insulted10==1
replace rp_insult_out_hlth = 1 if resinsulted5_10==0 & insulted10==1
replace rp_insult_out_hlth =0 if insulted10==0
replace rp_insult_out_hlth = -1 if insulted10==-1
replace rp_insult_out_hlth = -8 if insulted10==-8
label define rp_insult_out_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: outside (streets, parks, etc.)" 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_out_hlth rp_insult_out_hlth
label variable rp_insult_out_hlth "insulted - outside (streets, parks, etc.); health and disability"

gen rp_insult_out_nat = 2 if resinsulted6_10==1 & insulted10==1
replace rp_insult_out_nat = 1 if resinsulted6_10==0 & insulted10==1
replace rp_insult_out_nat =0 if insulted10==0
replace rp_insult_out_nat = -1 if insulted10==-1
replace rp_insult_out_nat = -8 if insulted10==-8
label define rp_insult_out_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: outside (streets, parks, etc.)" 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_out_nat rp_insult_out_nat
label variable rp_insult_out_nat "insulted - outside (streets, parks, etc.); nationality"

gen rp_insult_out_rel = 2 if resinsulted7_10==1 & insulted10==1
replace rp_insult_out_rel = 1 if resinsulted7_10==0 & insulted10==1
replace rp_insult_out_rel =0 if insulted10==0
replace rp_insult_out_rel = -1 if insulted10==-1
replace rp_insult_out_rel = -8 if insulted10==-8
label define rp_insult_out_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: outside (streets, parks, etc.)" 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_out_rel rp_insult_out_rel
label variable rp_insult_out_rel "insulted - outside (streets, parks, etc.); religion"

gen rp_insult_out_lang = 2 if resinsulted8_10==1 & insulted10==1
replace rp_insult_out_lang = 1 if resinsulted8_10==0 & insulted10==1
replace rp_insult_out_lang =0 if insulted10==0
replace rp_insult_out_lang = -1 if insulted10==-1
replace rp_insult_out_lang = -8 if insulted10==-8
label define rp_insult_out_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: outside (streets, parks, etc.)" 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_out_lang rp_insult_out_lang
label variable rp_insult_out_lang "insulted - outside (streets, parks, etc.); language or accent"

gen rp_insult_out_drss = 2 if resinsulted9_10==1 & insulted10==1
replace rp_insult_out_drss = 1 if resinsulted9_10==0 & insulted10==1
replace rp_insult_out_drss =0 if insulted10==0
replace rp_insult_out_drss = -1 if insulted10==-1
replace rp_insult_out_drss = -8 if insulted10==-8
label define rp_insult_out_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: outside (streets, parks, etc.)" 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_out_drss rp_insult_out_drss
label variable rp_insult_out_drss "insulted - outside (streets, parks, etc.); appearance or dress"

gen rp_insult_out_oth = 2 if resinsulted96_10==1 & insulted10==1
replace rp_insult_out_oth = 1 if resinsulted96_10==0 & insulted10==1
replace rp_insult_out_oth =0 if insulted10==0
replace rp_insult_out_oth = -1 if insulted10==-1
replace rp_insult_out_oth = -8 if insulted10==-8
label define rp_insult_out_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: outside (streets, parks, etc.)" 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_out_oth rp_insult_out_oth
label variable rp_insult_out_oth "insulted - outside (streets, parks, etc.); 'other reason'"
replace rp_insult_out_oth = 2 if resinsulted97_10==1

* Home

gen rp_insult_home_sex = 2 if resinsulted1_11==1 & insulted11==1
replace rp_insult_home_sex = 1 if resinsulted1_11==0 & insulted11==1
replace rp_insult_home_sex =0 if insulted11==0
replace rp_insult_home_sex = -1 if insulted11==-1
replace rp_insult_home_sex = -8 if insulted11==-8
label define rp_insult_home_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: at home" 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_home_sex rp_insult_home_sex
label variable rp_insult_home_sex "insulted - at home; sex"

gen rp_insult_home_age = 2 if resinsulted2_11==1 & insulted11==1
replace rp_insult_home_age = 1 if resinsulted2_11==0 & insulted11==1
replace rp_insult_home_age =0 if insulted11==0
replace rp_insult_home_age = -1 if insulted11==-1
replace rp_insult_home_age = -8 if insulted11==-8
label define rp_insult_home_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: at home" 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_home_age rp_insult_home_age
label variable rp_insult_home_age "insulted - at home; age"

gen rp_insult_home_eth = 2 if resinsulted3_11==1 & insulted11==1
replace rp_insult_home_eth = 1 if resinsulted3_11==0 & insulted11==1
replace rp_insult_home_eth =0 if insulted11==0
replace rp_insult_home_eth = -1 if insulted11==-1
replace rp_insult_home_eth = -8 if insulted11==-8
label define rp_insult_home_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: at home" 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_home_eth rp_insult_home_eth
label variable rp_insult_home_eth "insulted - at home; ethnicity"

gen rp_insult_home_sexor = 2 if resinsulted4_11==1 & insulted11==1
replace rp_insult_home_sexor = 1 if resinsulted4_11==0 & insulted11==1
replace rp_insult_home_sexor =0 if insulted11==0
replace rp_insult_home_sexor = -1 if insulted11==-1
replace rp_insult_home_sexor = -8 if insulted11==-8
label define rp_insult_home_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: at home" 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_home_sexor rp_insult_home_sexor
label variable rp_insult_home_sexor "insulted - at home; sexual orientation"

gen rp_insult_home_hlth = 2 if resinsulted5_11==1 & insulted11==1
replace rp_insult_home_hlth = 1 if resinsulted5_11==0 & insulted11==1
replace rp_insult_home_hlth =0 if insulted11==0
replace rp_insult_home_hlth = -1 if insulted11==-1
replace rp_insult_home_hlth = -8 if insulted11==-8
label define rp_insult_home_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: at home" 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_home_hlth rp_insult_home_hlth
label variable rp_insult_home_hlth "insulted - at home; health and disability"

gen rp_insult_home_nat = 2 if resinsulted6_11==1 & insulted11==1
replace rp_insult_home_nat = 1 if resinsulted6_11==0 & insulted11==1
replace rp_insult_home_nat =0 if insulted11==0
replace rp_insult_home_nat = -1 if insulted11==-1
replace rp_insult_home_nat = -8 if insulted11==-8
label define rp_insult_home_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: at home" 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_home_nat rp_insult_home_nat
label variable rp_insult_home_nat "insulted - at home; nationality"

gen rp_insult_home_rel = 2 if resinsulted7_11==1 & insulted11==1
replace rp_insult_home_rel = 1 if resinsulted7_11==0 & insulted11==1
replace rp_insult_home_rel =0 if insulted11==0
replace rp_insult_home_rel = -1 if insulted11==-1
replace rp_insult_home_rel = -8 if insulted11==-8
label define rp_insult_home_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: at home" 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_home_rel rp_insult_home_rel
label variable rp_insult_home_rel "insulted - at home; religion"

gen rp_insult_home_lang = 2 if resinsulted8_11==1 & insulted11==1
replace rp_insult_home_lang = 1 if resinsulted8_11==0 & insulted11==1
replace rp_insult_home_lang =0 if insulted11==0
replace rp_insult_home_lang = -1 if insulted11==-1
replace rp_insult_home_lang = -8 if insulted11==-8
label define rp_insult_home_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: at home" 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_home_lang rp_insult_home_lang
label variable rp_insult_home_lang "insulted - at home; language or accent"

gen rp_insult_home_drss = 2 if resinsulted9_11==1 & insulted11==1
replace rp_insult_home_drss = 1 if resinsulted9_11==0 & insulted11==1
replace rp_insult_home_drss =0 if insulted11==0
replace rp_insult_home_drss = -1 if insulted11==-1
replace rp_insult_home_drss = -8 if insulted11==-8
label define rp_insult_home_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: at home" 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_home_drss rp_insult_home_drss
label variable rp_insult_home_drss "insulted - at home; appearance or dress"

gen rp_insult_home_oth = 2 if resinsulted96_11==1 & insulted11==1
replace rp_insult_home_oth = 1 if resinsulted96_11==0 & insulted11==1
replace rp_insult_home_oth =0 if insulted11==0
replace rp_insult_home_oth = -1 if insulted11==-1
replace rp_insult_home_oth = -8 if insulted11==-8
label define rp_insult_home_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: at home" 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_home_oth rp_insult_home_oth
label variable rp_insult_home_oth "insulted - at home; 'other reason'"
replace rp_insult_home_oth = 2 if resinsulted97_11==1

* Other

gen rp_insult_other_sex = 2 if resinsulted1_12==1 & p_insult_other==1
replace rp_insult_other_sex = 1 if resinsulted1_12==0 & p_insult_other==1
replace rp_insult_other_sex =0 if p_insult_other==0
replace rp_insult_other_sex = -1 if p_insult_other==-1
replace rp_insult_other_sex = -8 if p_insult_other==-8
label define rp_insult_other_sex -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: other place" 1 "insulted: not sex" 2 "insulted: sex", modify
label values rp_insult_other_sex rp_insult_other_sex
label variable rp_insult_other_sex "insulted - other place; sex"

gen rp_insult_other_age = 2 if resinsulted2_12==1 & p_insult_other==1
replace rp_insult_other_age = 1 if resinsulted2_12==0 & p_insult_other==1
replace rp_insult_other_age =0 if p_insult_other==0
replace rp_insult_other_age = -1 if p_insult_other==-1
replace rp_insult_other_age = -8 if p_insult_other==-8
label define rp_insult_other_age -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: other place" 1 "insulted: not age" 2 "insulted: age", modify
label values rp_insult_other_age rp_insult_other_age
label variable rp_insult_other_age "insulted - other place; age"

gen rp_insult_other_eth = 2 if resinsulted3_12==1 & p_insult_other==1
replace rp_insult_other_eth = 1 if resinsulted3_12==0 & p_insult_other==1
replace rp_insult_other_eth =0 if p_insult_other==0
replace rp_insult_other_eth = -1 if p_insult_other==-1
replace rp_insult_other_eth = -8 if p_insult_other==-8
label define rp_insult_other_eth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: other place" 1 "insulted: not ethnicity" 2 "insulted: ethnicity", modify
label values rp_insult_other_eth rp_insult_other_eth
label variable rp_insult_other_eth "insulted - other place; ethnicity"

gen rp_insult_other_sexor = 2 if resinsulted4_12==1 & p_insult_other==1
replace rp_insult_other_sexor = 1 if resinsulted4_12==0 & p_insult_other==1
replace rp_insult_other_sexor =0 if p_insult_other==0
replace rp_insult_other_sexor = -1 if p_insult_other==-1
replace rp_insult_other_sexor = -8 if p_insult_other==-8
label define rp_insult_other_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: other place" 1 "insulted: not sexual orientation" 2 "insulted: sexual orientation", modify
label values rp_insult_other_sexor rp_insult_other_sexor
label variable rp_insult_other_sexor "insulted - other place; sexual orientation"

gen rp_insult_other_hlth = 2 if resinsulted5_12==1 & p_insult_other==1
replace rp_insult_other_hlth = 1 if resinsulted5_12==0 & p_insult_other==1
replace rp_insult_other_hlth =0 if p_insult_other==0
replace rp_insult_other_hlth = -1 if p_insult_other==-1
replace rp_insult_other_hlth = -8 if p_insult_other==-8
label define rp_insult_other_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: other place" 1 "insulted: not health and disability" 2 "insulted: health and disability", modify
label values rp_insult_other_hlth rp_insult_other_hlth
label variable rp_insult_other_hlth "insulted - other place; health and disability"

gen rp_insult_other_nat = 2 if resinsulted6_12==1 & p_insult_other==1
replace rp_insult_other_nat = 1 if resinsulted6_12==0 & p_insult_other==1
replace rp_insult_other_nat =0 if p_insult_other==0
replace rp_insult_other_nat = -1 if p_insult_other==-1
replace rp_insult_other_nat = -8 if p_insult_other==-8
label define rp_insult_other_nat -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: other place" 1 "insulted: not nationality" 2 "insulted: nationality", modify
label values rp_insult_other_nat rp_insult_other_nat
label variable rp_insult_other_nat "insulted - other place; nationality"

gen rp_insult_other_rel = 2 if resinsulted7_12==1 & p_insult_other==1
replace rp_insult_other_rel = 1 if resinsulted7_12==0 & p_insult_other==1
replace rp_insult_other_rel =0 if p_insult_other==0
replace rp_insult_other_rel = -1 if p_insult_other==-1
replace rp_insult_other_rel = -8 if p_insult_other==-8
label define rp_insult_other_rel -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: other place" 1 "insulted: not religion" 2 "insulted: religion", modify
label values rp_insult_other_rel rp_insult_other_rel
label variable rp_insult_other_rel "insulted - other place; religion"

gen rp_insult_other_lang = 2 if resinsulted8_12==1 & p_insult_other==1
replace rp_insult_other_lang = 1 if resinsulted8_12==0 & p_insult_other==1
replace rp_insult_other_lang =0 if p_insult_other==0
replace rp_insult_other_lang = -1 if p_insult_other==-1
replace rp_insult_other_lang = -8 if p_insult_other==-8
label define rp_insult_other_lang -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: other place" 1 "insulted: not language or accent" 2 "insulted: language or accent", modify
label values rp_insult_other_lang rp_insult_other_lang
label variable rp_insult_other_lang "insulted - other place; language or accent"

gen rp_insult_other_drss = 2 if resinsulted9_12==1 & p_insult_other==1
replace rp_insult_other_drss = 1 if resinsulted9_12==0 & p_insult_other==1
replace rp_insult_other_drss =0 if p_insult_other==0
replace rp_insult_other_drss = -1 if p_insult_other==-1
replace rp_insult_other_drss = -8 if p_insult_other==-8
label define rp_insult_other_drss -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: other place" 1 "insulted: not appearance or dress" 2 "insulted: appearance or dress", modify
label values rp_insult_other_drss rp_insult_other_drss
label variable rp_insult_other_drss "insulted - other place; appearance or dress"

gen rp_insult_other_oth = 2 if resinsulted96_12==1 & p_insult_other==1
replace rp_insult_other_oth = 1 if resinsulted96_12==0 & p_insult_other==1
replace rp_insult_other_oth =0 if p_insult_other==0
replace rp_insult_other_oth = -1 if p_insult_other==-1
replace rp_insult_other_oth = -8 if p_insult_other==-8
label define rp_insult_other_oth -8 "Inapplicable" -1 "Don't know" 0 "Not insulted: other place" 1 "insulted: not 'other reason'" 2 "insulted: 'other reason'", modify
label values rp_insult_other_oth rp_insult_other_oth
label variable rp_insult_other_oth "insulted - other place; 'other reason'"
replace rp_insult_other_oth = 2 if resinsulted97_12==1

********************************************************************************

//v1
ge attacked_anywhere=.
replace attacked_anywhere=1 if attacked96==0
replace attacked_anywhere=0 if attacked96==1
replace attacked_anywhere=-8 if attacked96==-8

lab var attacked_anywhere "whether attacked any place"
lab define attacked_anywhere_lab 0"no" 1"yes" -8"not applicable"
lab val attacked_anywhere attacked_anywhere_lab

//v2
ge attacked_anywhere2=.
replace attacked_anywhere2=1 if attacked96==0
replace attacked_anywhere2=0 if attacked96==1

lab var attacked_anywhere2 "whether attacked any place- no inapplicable"
lab val attacked_anywhere2 attacked_anywhere2_lab



***
*** Measures of WHERE people were attacked
***

clonevar p_attack_schl = attacked1
clonevar p_attack_uni = attacked2
clonevar p_attack_wrk = attacked3
clonevar p_attack_ptran = attacked4
clonevar p_attack_btstn = attacked5
clonevar p_attack_shpc = attacked6
clonevar p_attack_cincf = attacked7
clonevar p_attack_nsoc = attacked8
clonevar p_attack_cpark = attacked9
clonevar p_attack_out = attacked10
clonevar p_attack_home = attacked11
clonevar p_attack_other = attacked97
label variable p_attack_schl "Place(s) attacked: School"
label variable p_attack_uni "Place(s) attacked: College/University"
label variable p_attack_wrk "Place(s) attacked: at work"
label variable p_attack_ptran "Place(s) attacked: On public transport"
label variable p_attack_btstn "Place(s) attacked: At/near Bus/train station"
label variable p_attack_shpc "Place(s) attacked: In Shopping Centres, etc"
label variable p_attack_cincf "Place(s) attacked: In cinema, cafes, etc."
label variable p_attack_nsoc "Place(s) attacked: At pub/disco/club"
label variable p_attack_cpark "Place(s) attacked: in car parks"
label variable p_attack_out "Place(s) attacked: Outside, street/park"
label variable p_attack_home "Place(s) attacked: at home"
label variable p_attack_other "Place(s) attacked: Other Places"

* Recoding p_unsafe missings

recode p_attack_schl- p_attack_other (-9=.) (-7/-2=.)

* Recoding 'other places' into p_unsafe variables

replace p_attack_schl = 1 if p_attack_schl!=1 & attackedo_code==1
replace p_attack_uni = 1 if p_attack_uni!=1 & attackedo_code==2
replace p_attack_wrk = 1 if p_attack_wrk!=1 & attackedo_code==3
replace p_attack_ptran = 1 if p_attack_ptran!=1 & attackedo_code==4
replace p_attack_btstn = 1 if p_attack_btstn!=1 & attackedo_code==5
replace p_attack_shpc = 1 if p_attack_shpc!=1 & attackedo_code==6
replace p_attack_cincf = 1 if p_attack_cincf!=1 & attackedo_code==7
replace p_attack_nsoc = 1 if p_attack_nsoc!=1 & attackedo_code==8
replace p_attack_cpark = 1 if p_attack_cpark!=1 & attackedo_code==9
replace p_attack_out = 1 if p_attack_out!=1 & attackedo_code==10
replace p_attack_home = 1 if p_attack_home!=1 & attackedo_code==11

* Removing these 'substantive' options from the 'p_attack_other' variable

replace p_attack_other = 0 if unsafeo_code>2 & attackedo_code<12

***
*** Measures of WHY people were attacked 
***

* Sex

gen r_attack_sex = .
replace r_attack_sex = 1 if resattacked1_1==1 | resattacked1_2==1 | resattacked1_3==1 | resattacked1_4==1 | resattacked1_5==1 | resattacked1_6==1 | resattacked1_7==1 | resattacked1_8==1 | resattacked1_9==1 | resattacked1_10==1 | resattacked1_11==1 | resattacked1_12==1
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_1==0
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_2==0
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_3==0
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_4==0
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_5==0
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_6==0
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_7==0
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_8==0
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_9==0
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_10==0
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_11==0
replace r_attack_sex = 0 if r_attack_sex!=1 & resattacked1_12==0

replace r_attack_sex = 0 if (r_attack_sex!=1 | r_attack_sex!=0) & attacked_anywhere==0
replace r_attack_sex = -8 if (r_attack_sex!=1 | r_attack_sex!=0) & attacked_anywhere==-8

label define r_ -8 "Inapplicable" 0 "No" 1 "Yes", modify
label values r_attack_sex r_
label variable r_attack_sex "Reason attacked: sex"

* Age

gen r_attack_age = .
replace r_attack_age = 1 if resattacked2_1==1 | resattacked2_2==1 | resattacked2_3==1 | resattacked2_4==1 | resattacked2_5==1 | resattacked2_6==1 | resattacked2_7==1 | resattacked2_8==1 | resattacked2_9==1 | resattacked2_10==1 | resattacked2_11==1 | resattacked2_12==1
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_1==0
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_2==0
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_3==0
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_4==0
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_5==0
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_6==0
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_7==0
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_8==0
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_9==0
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_10==0
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_11==0
replace r_attack_age = 0 if r_attack_age!=1 & resattacked2_12==0

replace r_attack_age = 0 if (r_attack_age!=1 | r_attack_age!=0) & attacked_anywhere==0
replace r_attack_age = -8 if (r_attack_age!=1 | r_attack_age!=0) & attacked_anywhere==-8

label values r_attack_age r_
label variable r_attack_age "Reason attacked: age"

* Ethnicity

gen r_attack_eth = .
replace r_attack_eth = 1 if resattacked3_1==1 | resattacked3_2==1 | resattacked3_3==1 | resattacked3_4==1 | resattacked3_5==1 | resattacked3_6==1 | resattacked3_7==1 | resattacked3_8==1 | resattacked3_9==1 | resattacked3_10==1 | resattacked3_11==1 | resattacked3_12==1
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_1==0
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_2==0
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_3==0
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_4==0
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_5==0
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_6==0
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_7==0
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_8==0
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_9==0
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_10==0
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_11==0
replace r_attack_eth = 0 if r_attack_eth!=1 & resattacked3_12==0

replace r_attack_eth = 0 if (r_attack_eth!=1 | r_attack_eth!=0) & attacked_anywhere==0
replace r_attack_eth = -8 if (r_attack_eth!=1 | r_attack_eth!=0) & attacked_anywhere==-8

label values r_attack_eth r_
label variable r_attack_eth "Reason attacked: ethnicity"

* Sexual Orientation

gen r_attack_sexor = .
replace r_attack_sexor = 1 if resattacked4_1==1 | resattacked4_2==1 | resattacked4_3==1 | resattacked4_4==1 | resattacked4_5==1 | resattacked4_6==1 | resattacked4_7==1 | resattacked4_8==1 | resattacked4_9==1 | resattacked4_10==1 | resattacked4_11==1 | resattacked4_12==1
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_1==0
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_2==0
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_3==0
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_4==0
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_5==0
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_6==0
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_7==0
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_8==0
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_9==0
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_10==0
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_11==0
replace r_attack_sexor = 0 if r_attack_sexor!=1 & resattacked4_12==0

replace r_attack_sexor = 0 if (r_attack_sexor!=1 | r_attack_sexor!=0) & attacked_anywhere==0
replace r_attack_sexor = -8 if (r_attack_sexor!=1 | r_attack_sexor!=0) & attacked_anywhere==-8

label values r_attack_sexor r_
label variable r_attack_sexor "Reason attacked: sexual orientation"

* Disability

gen r_attack_hlth = .
replace r_attack_hlth = 1 if resattacked5_1==1 | resattacked5_2==1 | resattacked5_3==1 | resattacked5_4==1 | resattacked5_5==1 | resattacked5_6==1 | resattacked5_7==1 | resattacked5_8==1 | resattacked5_9==1 | resattacked5_10==1 | resattacked5_11==1 | resattacked5_12==1
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_1==0
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_2==0
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_3==0
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_4==0
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_5==0
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_6==0
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_7==0
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_8==0
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_9==0
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_10==0
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_11==0
replace r_attack_hlth = 0 if r_attack_hlth!=1 & resattacked5_12==0

replace r_attack_hlth = 0 if (r_attack_hlth!=1 | r_attack_hlth!=0) & attacked_anywhere==0
replace r_attack_hlth = -8 if (r_attack_hlth!=1 | r_attack_hlth!=0) & attacked_anywhere==-8

label values r_attack_hlth r_
label variable r_attack_hlth "Reason attacked: health and disability"

* Nationality

gen r_attack_nat = .
replace r_attack_nat = 1 if resattacked6_1==1 | resattacked6_2==1 | resattacked6_3==1 | resattacked6_4==1 | resattacked6_5==1 | resattacked6_6==1 | resattacked6_7==1 | resattacked6_8==1 | resattacked6_9==1 | resattacked6_10==1 | resattacked6_11==1 | resattacked6_12==1
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_1==0
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_2==0
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_3==0
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_4==0
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_5==0
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_6==0
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_7==0
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_8==0
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_9==0
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_10==0
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_11==0
replace r_attack_nat = 0 if r_attack_nat!=1 & resattacked6_12==0

replace r_attack_nat = 0 if (r_attack_nat!=1 | r_attack_nat!=0) & attacked_anywhere==0
replace r_attack_nat = -8 if (r_attack_nat!=1 | r_attack_nat!=0) & attacked_anywhere==-8

label values r_attack_nat r_
label variable r_attack_nat "Reason attacked: nationality"

* Religion

gen r_attack_rel = .
replace r_attack_rel = 1 if resattacked7_1==1 | resattacked7_2==1 | resattacked7_3==1 | resattacked7_4==1 | resattacked7_5==1 | resattacked7_6==1 | resattacked7_7==1 | resattacked7_8==1 | resattacked7_9==1 | resattacked7_10==1 | resattacked7_11==1 | resattacked7_12==1
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_1==0
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_2==0
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_3==0
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_4==0
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_5==0
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_6==0
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_7==0
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_8==0
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_9==0
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_10==0
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_11==0
replace r_attack_rel = 0 if r_attack_rel!=1 & resattacked7_12==0

replace r_attack_rel = 0 if (r_attack_rel!=1 | r_attack_rel!=0) & attacked_anywhere==0
replace r_attack_rel = -8 if (r_attack_rel!=1 | r_attack_rel!=0) & attacked_anywhere==-8

label values r_attack_rel r_
label variable r_attack_rel "Reason attacked: religion"

* Language/Accent

gen r_attack_lang = .
replace r_attack_lang = 1 if resattacked8_1==1 | resattacked8_2==1 | resattacked8_3==1 | resattacked8_4==1 | resattacked8_5==1 | resattacked8_6==1 | resattacked8_7==1 | resattacked8_8==1 | resattacked8_9==1 | resattacked8_10==1 | resattacked8_11==1 | resattacked8_12==1
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_1==0
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_2==0
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_3==0
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_4==0
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_5==0
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_6==0
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_7==0
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_8==0
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_9==0
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_10==0
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_11==0
replace r_attack_lang = 0 if r_attack_lang!=1 & resattacked8_12==0

replace r_attack_lang = 0 if (r_attack_lang!=1 | r_attack_lang!=0) & attacked_anywhere==0
replace r_attack_lang = -8 if (r_attack_lang!=1 | r_attack_lang!=0) & attacked_anywhere==-8

label values r_attack_lang r_
label variable r_attack_lang "Reason attacked: language or accent"

* Language/Accent

gen r_attack_drss = .
replace r_attack_drss = 1 if resattacked9_1==1 | resattacked9_2==1 | resattacked9_3==1 | resattacked9_4==1 | resattacked9_5==1 | resattacked9_6==1 | resattacked9_7==1 | resattacked9_8==1 | resattacked9_9==1 | resattacked9_10==1 | resattacked9_11==1 | resattacked9_12==1
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_1==0
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_2==0
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_3==0
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_4==0
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_5==0
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_6==0
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_7==0
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_8==0
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_9==0
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_10==0
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_11==0
replace r_attack_drss = 0 if r_attack_drss!=1 & resattacked9_12==0

replace r_attack_drss = 0 if (r_attack_drss!=1 | r_attack_drss!=0) & attacked_anywhere==0
replace r_attack_drss = -8 if (r_attack_drss!=1 | r_attack_drss!=0) & attacked_anywhere==-8

label values r_attack_drss r_
label variable r_attack_drss "Reason attacked: appearance or dress"

* Other reason/none of the above

gen r_attack_other = .
replace r_attack_other = 1 if resattacked96_1==1 | resattacked96_2==1 | resattacked96_3==1 | resattacked96_4==1 | resattacked96_5==1 | resattacked96_6==1 | resattacked96_7==1 | resattacked96_8==1 | resattacked96_9==1 | resattacked96_10==1 | resattacked96_11==1 | resattacked96_12==1
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_1==0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_2==0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_3==0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_4==0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_5==0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_6==0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_7==0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_8==0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_9==0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_10==0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_11==0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked96_12==0

replace r_attack_other = 0 if (r_attack_other!=1 | r_attack_other!=0) & attacked_anywhere==0
replace r_attack_other = -8 if (r_attack_other!=1 | r_attack_other!=0) & attacked_anywhere==-8

label values r_attack_other r_
label variable r_attack_other "Reason attacked: other reason/none of the above"

replace r_attack_other = 1 if (resattacked97_1==1 | resattacked97_2==1 | resattacked97_3==1 | resattacked97_4==1 | resattacked97_5==1 | resattacked97_6==1 | resattacked97_7==1 | resattacked97_8==1 | resattacked97_9==1 | resattacked97_10==1 | resattacked97_11==1 | resattacked97_12==1) & r_attack_other!=1
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_1==0 & r_attack_other!=0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_2==0 & r_attack_other!=0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_3==0 & r_attack_other!=0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_4==0 & r_attack_other!=0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_5==0 & r_attack_other!=0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_6==0 & r_attack_other!=0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_7==0 & r_attack_other!=0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_8==0 & r_attack_other!=0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_9==0 & r_attack_other!=0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_10==0 & r_attack_other!=0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_11==0 & r_attack_other!=0
replace r_attack_other = 0 if r_attack_other!=1 & resattacked97_12==0 & r_attack_other!=0

***
*** Measures of WHY people were ATTACKED in particular places
***

* SCHOOL

gen rp_attack_schl_sex = 2 if resattacked1_1==1 & attacked1==1
replace rp_attack_schl_sex = 1 if resattacked1_1==0 & attacked1==1
replace rp_attack_schl_sex = 0 if attacked1==0
replace rp_attack_schl_sex = -1 if attacked1==-1
replace rp_attack_schl_sex = -8 if attacked1==-8
label define rp_attack_schl_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: school" 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_schl_sex rp_attack_schl_sex
label variable rp_attack_schl_sex "attacked - school; sex"

gen rp_attack_schl_age = 2 if resattacked2_1==1 & attacked1==1
replace rp_attack_schl_age = 1 if resattacked2_1==0 & attacked1==1
replace rp_attack_schl_age =0 if attacked1==0
replace rp_attack_schl_age = -1 if attacked1==-1
replace rp_attack_schl_age = -8 if attacked1==-8
label define rp_attack_schl_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: school" 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_schl_age rp_attack_schl_age
label variable rp_attack_schl_age "attacked - school; age"

gen rp_attack_schl_eth = 2 if resattacked3_1==1 & attacked1==1
replace rp_attack_schl_eth = 1 if resattacked3_1==0 & attacked1==1
replace rp_attack_schl_eth =0 if attacked1==0
replace rp_attack_schl_eth = -1 if attacked1==-1
replace rp_attack_schl_eth = -8 if attacked1==-8
label define rp_attack_schl_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: school" 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_schl_eth rp_attack_schl_eth
label variable rp_attack_schl_eth "attacked - school; ethnicity"

gen rp_attack_schl_sexor = 2 if resattacked4_1==1 & attacked1==1
replace rp_attack_schl_sexor = 1 if resattacked4_1==0 & attacked1==1
replace rp_attack_schl_sexor =0 if attacked1==0
replace rp_attack_schl_sexor = -1 if attacked1==-1
replace rp_attack_schl_sexor = -8 if attacked1==-8
label define rp_attack_schl_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: school" 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_schl_sexor rp_attack_schl_sexor
label variable rp_attack_schl_sexor "attacked - school; sexual orientation"

gen rp_attack_schl_hlth = 2 if resattacked5_1==1 & attacked1==1
replace rp_attack_schl_hlth = 1 if resattacked5_1==0 & attacked1==1
replace rp_attack_schl_hlth =0 if attacked1==0
replace rp_attack_schl_hlth = -1 if attacked1==-1
replace rp_attack_schl_hlth = -8 if attacked1==-8
label define rp_attack_schl_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: school" 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_schl_hlth rp_attack_schl_hlth
label variable rp_attack_schl_hlth "attacked - school; health and disability"

gen rp_attack_schl_nat = 2 if resattacked6_1==1 & attacked1==1
replace rp_attack_schl_nat = 1 if resattacked6_1==0 & attacked1==1
replace rp_attack_schl_nat =0 if attacked1==0
replace rp_attack_schl_nat = -1 if attacked1==-1
replace rp_attack_schl_nat = -8 if attacked1==-8
label define rp_attack_schl_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: school" 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_schl_nat rp_attack_schl_nat
label variable rp_attack_schl_nat "attacked - school; nationality"

gen rp_attack_schl_rel = 2 if resattacked7_1==1 & attacked1==1
replace rp_attack_schl_rel = 1 if resattacked7_1==0 & attacked1==1
replace rp_attack_schl_rel =0 if attacked1==0
replace rp_attack_schl_rel = -1 if attacked1==-1
replace rp_attack_schl_rel = -8 if attacked1==-8
label define rp_attack_schl_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: school" 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_schl_rel rp_attack_schl_rel
label variable rp_attack_schl_rel "attacked - school; religion"

gen rp_attack_schl_lang = 2 if resattacked8_1==1 & attacked1==1
replace rp_attack_schl_lang = 1 if resattacked8_1==0 & attacked1==1
replace rp_attack_schl_lang =0 if attacked1==0
replace rp_attack_schl_lang = -1 if attacked1==-1
replace rp_attack_schl_lang = -8 if attacked1==-8
label define rp_attack_schl_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: school" 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_schl_lang rp_attack_schl_lang
label variable rp_attack_schl_lang "attacked - school; language or accent"

gen rp_attack_schl_drss = 2 if resattacked9_1==1 & attacked1==1
replace rp_attack_schl_drss = 1 if resattacked9_1==0 & attacked1==1
replace rp_attack_schl_drss =0 if attacked1==0
replace rp_attack_schl_drss = -1 if attacked1==-1
replace rp_attack_schl_drss = -8 if attacked1==-8
label define rp_attack_schl_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: school" 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_schl_drss rp_attack_schl_drss
label variable rp_attack_schl_drss "attacked - school; appearance or dress"

gen rp_attack_schl_oth = 2 if resattacked96_1==1 & attacked1==1
replace rp_attack_schl_oth = 1 if resattacked96_1==0 & attacked1==1
replace rp_attack_schl_oth =0 if attacked1==0
replace rp_attack_schl_oth = -1 if attacked1==-1
replace rp_attack_schl_oth = -8 if attacked1==-8
label define rp_attack_schl_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: school" 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_schl_oth rp_attack_schl_oth
label variable rp_attack_schl_oth "attacked - school; 'other reason'"
replace rp_attack_schl_oth = 2 if resattacked97_1==1

* In college/uni

gen rp_attack_uni_sex = 2 if resattacked1_2==1 & attacked2==1
replace rp_attack_uni_sex = 1 if resattacked1_2==0 & attacked2==1
replace rp_attack_uni_sex =0 if attacked2==0
replace rp_attack_uni_sex = -1 if attacked2==-1
replace rp_attack_uni_sex = -8 if attacked2==-8
label define rp_attack_uni_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: college/uni" 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_uni_sex rp_attack_uni_sex
label variable rp_attack_uni_sex "attacked - college/uni; sex"

gen rp_attack_uni_age = 2 if resattacked2_2==1 & attacked2==1
replace rp_attack_uni_age = 1 if resattacked2_2==0 & attacked2==1
replace rp_attack_uni_age =0 if attacked2==0
replace rp_attack_uni_age = -1 if attacked2==-1
replace rp_attack_uni_age = -8 if attacked2==-8
label define rp_attack_uni_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: college/uni" 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_uni_age rp_attack_uni_age
label variable rp_attack_uni_age "attacked - college/uni; age"

gen rp_attack_uni_eth = 2 if resattacked3_2==1 & attacked2==1
replace rp_attack_uni_eth = 1 if resattacked3_2==0 & attacked2==1
replace rp_attack_uni_eth =0 if attacked2==0
replace rp_attack_uni_eth = -1 if attacked2==-1
replace rp_attack_uni_eth = -8 if attacked2==-8
label define rp_attack_uni_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: college/uni" 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_uni_eth rp_attack_uni_eth
label variable rp_attack_uni_eth "attacked - college/uni; ethnicity"

gen rp_attack_uni_sexor = 2 if resattacked4_2==1 & attacked2==1
replace rp_attack_uni_sexor = 1 if resattacked4_2==0 & attacked2==1
replace rp_attack_uni_sexor =0 if attacked2==0
replace rp_attack_uni_sexor = -1 if attacked2==-1
replace rp_attack_uni_sexor = -8 if attacked2==-8
label define rp_attack_uni_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: college/uni" 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_uni_sexor rp_attack_uni_sexor
label variable rp_attack_uni_sexor "attacked - college/uni; sexual orientation"

gen rp_attack_uni_hlth = 2 if resattacked5_2==1 & attacked2==1
replace rp_attack_uni_hlth = 1 if resattacked5_2==0 & attacked2==1
replace rp_attack_uni_hlth =0 if attacked2==0
replace rp_attack_uni_hlth = -1 if attacked2==-1
replace rp_attack_uni_hlth = -8 if attacked2==-8
label define rp_attack_uni_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: college/uni" 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_uni_hlth rp_attack_uni_hlth
label variable rp_attack_uni_hlth "attacked - college/uni; health and disability"

gen rp_attack_uni_nat = 2 if resattacked6_2==1 & attacked2==1
replace rp_attack_uni_nat = 1 if resattacked6_2==0 & attacked2==1
replace rp_attack_uni_nat =0 if attacked2==0
replace rp_attack_uni_nat = -1 if attacked2==-1
replace rp_attack_uni_nat = -8 if attacked2==-8
label define rp_attack_uni_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: college/uni" 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_uni_nat rp_attack_uni_nat
label variable rp_attack_uni_nat "attacked - college/uni; nationality"

gen rp_attack_uni_rel = 2 if resattacked7_2==1 & attacked2==1
replace rp_attack_uni_rel = 1 if resattacked7_2==0 & attacked2==1
replace rp_attack_uni_rel =0 if attacked2==0
replace rp_attack_uni_rel = -1 if attacked2==-1
replace rp_attack_uni_rel = -8 if attacked2==-8
label define rp_attack_uni_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: college/uni" 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_uni_rel rp_attack_uni_rel
label variable rp_attack_uni_rel "attacked - college/uni; religion"

gen rp_attack_uni_lang = 2 if resattacked8_2==1 & attacked2==1
replace rp_attack_uni_lang = 1 if resattacked8_2==0 & attacked2==1
replace rp_attack_uni_lang =0 if attacked2==0
replace rp_attack_uni_lang = -1 if attacked2==-1
replace rp_attack_uni_lang = -8 if attacked2==-8
label define rp_attack_uni_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: college/uni" 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_uni_lang rp_attack_uni_lang
label variable rp_attack_uni_lang "attacked - college/uni; language or accent"

gen rp_attack_uni_drss = 2 if resattacked9_2==1 & attacked2==1
replace rp_attack_uni_drss = 1 if resattacked9_2==0 & attacked2==1
replace rp_attack_uni_drss =0 if attacked2==0
replace rp_attack_uni_drss = -1 if attacked2==-1
replace rp_attack_uni_drss = -8 if attacked2==-8
label define rp_attack_uni_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: college/uni" 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_uni_drss rp_attack_uni_drss
label variable rp_attack_uni_drss "attacked - college/uni; appearance or dress"

gen rp_attack_uni_oth = 2 if resattacked96_2==1 & attacked2==1
replace rp_attack_uni_oth = 1 if resattacked96_2==0 & attacked2==1
replace rp_attack_uni_oth =0 if attacked2==0
replace rp_attack_uni_oth = -1 if attacked2==-1
replace rp_attack_uni_oth = -8 if attacked2==-8
label define rp_attack_uni_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: college/uni" 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_uni_oth rp_attack_uni_oth
label variable rp_attack_uni_oth "attacked - college/uni; 'other reason'"
replace rp_attack_uni_oth = 2 if resattacked97_2==1

* Work

gen rp_attack_wrk_sex = 2 if resattacked1_3==1 & attacked3==1
replace rp_attack_wrk_sex = 1 if resattacked1_3==0 & attacked3==1
replace rp_attack_wrk_sex =0 if attacked3==0
replace rp_attack_wrk_sex = -1 if attacked3==-1
replace rp_attack_wrk_sex = -8 if attacked3==-8
label define rp_attack_wrk_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: work" 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_wrk_sex rp_attack_wrk_sex
label variable rp_attack_wrk_sex "attacked - work; sex"

gen rp_attack_wrk_age = 2 if resattacked2_3==1 & attacked3==1
replace rp_attack_wrk_age = 1 if resattacked2_3==0 & attacked3==1
replace rp_attack_wrk_age =0 if attacked3==0
replace rp_attack_wrk_age = -1 if attacked3==-1
replace rp_attack_wrk_age = -8 if attacked3==-8
label define rp_attack_wrk_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: work" 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_wrk_age rp_attack_wrk_age
label variable rp_attack_wrk_age "attacked - work; age"

gen rp_attack_wrk_eth = 2 if resattacked3_3==1 & attacked3==1
replace rp_attack_wrk_eth = 1 if resattacked3_3==0 & attacked3==1
replace rp_attack_wrk_eth =0 if attacked3==0
replace rp_attack_wrk_eth = -1 if attacked3==-1
replace rp_attack_wrk_eth = -8 if attacked3==-8
label define rp_attack_wrk_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: work" 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_wrk_eth rp_attack_wrk_eth
label variable rp_attack_wrk_eth "attacked - work; ethnicity"

gen rp_attack_wrk_sexor = 2 if resattacked4_3==1 & attacked3==1
replace rp_attack_wrk_sexor = 1 if resattacked4_3==0 & attacked3==1
replace rp_attack_wrk_sexor =0 if attacked3==0
replace rp_attack_wrk_sexor = -1 if attacked3==-1
replace rp_attack_wrk_sexor = -8 if attacked3==-8
label define rp_attack_wrk_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: work" 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_wrk_sexor rp_attack_wrk_sexor
label variable rp_attack_wrk_sexor "attacked - work; sexual orientation"

gen rp_attack_wrk_hlth = 2 if resattacked5_3==1 & attacked3==1
replace rp_attack_wrk_hlth = 1 if resattacked5_3==0 & attacked3==1
replace rp_attack_wrk_hlth =0 if attacked3==0
replace rp_attack_wrk_hlth = -1 if attacked3==-1
replace rp_attack_wrk_hlth = -8 if attacked3==-8
label define rp_attack_wrk_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: work" 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_wrk_hlth rp_attack_wrk_hlth
label variable rp_attack_wrk_hlth "attacked - work; health and disability"

gen rp_attack_wrk_nat = 2 if resattacked6_3==1 & attacked3==1
replace rp_attack_wrk_nat = 1 if resattacked6_3==0 & attacked3==1
replace rp_attack_wrk_nat =0 if attacked3==0
replace rp_attack_wrk_nat = -1 if attacked3==-1
replace rp_attack_wrk_nat = -8 if attacked3==-8
label define rp_attack_wrk_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: work" 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_wrk_nat rp_attack_wrk_nat
label variable rp_attack_wrk_nat "attacked - work; nationality"

gen rp_attack_wrk_rel = 2 if resattacked7_3==1 & attacked3==1
replace rp_attack_wrk_rel = 1 if resattacked7_3==0 & attacked3==1
replace rp_attack_wrk_rel =0 if attacked3==0
replace rp_attack_wrk_rel = -1 if attacked3==-1
replace rp_attack_wrk_rel = -8 if attacked3==-8
label define rp_attack_wrk_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: work" 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_wrk_rel rp_attack_wrk_rel
label variable rp_attack_wrk_rel "attacked - work; religion"

gen rp_attack_wrk_lang = 2 if resattacked8_3==1 & attacked3==1
replace rp_attack_wrk_lang = 1 if resattacked8_3==0 & attacked3==1
replace rp_attack_wrk_lang =0 if attacked3==0
replace rp_attack_wrk_lang = -1 if attacked3==-1
replace rp_attack_wrk_lang = -8 if attacked3==-8
label define rp_attack_wrk_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: work" 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_wrk_lang rp_attack_wrk_lang
label variable rp_attack_wrk_lang "attacked - work; language or accent"

gen rp_attack_wrk_drss = 2 if resattacked9_3==1 & attacked3==1
replace rp_attack_wrk_drss = 1 if resattacked9_3==0 & attacked3==1
replace rp_attack_wrk_drss =0 if attacked3==0
replace rp_attack_wrk_drss = -1 if attacked3==-1
replace rp_attack_wrk_drss = -8 if attacked3==-8
label define rp_attack_wrk_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: work" 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_wrk_drss rp_attack_wrk_drss
label variable rp_attack_wrk_drss "attacked - work; appearance or dress"

gen rp_attack_wrk_oth = 2 if resattacked96_3==1 & attacked3==1
replace rp_attack_wrk_oth = 1 if resattacked96_3==0 & attacked3==1
replace rp_attack_wrk_oth =0 if attacked3==0
replace rp_attack_wrk_oth = -1 if attacked3==-1
replace rp_attack_wrk_oth = -8 if attacked3==-8
label define rp_attack_wrk_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: work" 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_wrk_oth rp_attack_wrk_oth
label variable rp_attack_wrk_oth "attacked - work; 'other reason'"
replace rp_attack_wrk_oth = 2 if resattacked97_3==1

* Public Transportation

gen rp_attack_ptran_sex = 2 if resattacked1_4==1 & attacked4==1
replace rp_attack_ptran_sex = 1 if resattacked1_4==0 & attacked4==1
replace rp_attack_ptran_sex =0 if attacked4==0
replace rp_attack_ptran_sex = -1 if attacked4==-1
replace rp_attack_ptran_sex = -8 if attacked4==-8
label define rp_attack_ptran_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pub. trans." 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_ptran_sex rp_attack_ptran_sex
label variable rp_attack_ptran_sex "attacked - public transportation; sex"

gen rp_attack_ptran_age = 2 if resattacked2_4==1 & attacked4==1
replace rp_attack_ptran_age = 1 if resattacked2_4==0 & attacked4==1
replace rp_attack_ptran_age =0 if attacked4==0
replace rp_attack_ptran_age = -1 if attacked4==-1
replace rp_attack_ptran_age = -8 if attacked4==-8
label define rp_attack_ptran_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pub. trans." 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_ptran_age rp_attack_ptran_age
label variable rp_attack_ptran_age "attacked - public transportation; age"

gen rp_attack_ptran_eth = 2 if resattacked3_4==1 & attacked4==1
replace rp_attack_ptran_eth = 1 if resattacked3_4==0 & attacked4==1
replace rp_attack_ptran_eth =0 if attacked4==0
replace rp_attack_ptran_eth = -1 if attacked4==-1
replace rp_attack_ptran_eth = -8 if attacked4==-8
label define rp_attack_ptran_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pub. trans." 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_ptran_eth rp_attack_ptran_eth
label variable rp_attack_ptran_eth "attacked - public transportation; ethnicity"

gen rp_attack_ptran_sexor = 2 if resattacked4_4==1 & attacked4==1
replace rp_attack_ptran_sexor = 1 if resattacked4_4==0 & attacked4==1
replace rp_attack_ptran_sexor =0 if attacked4==0
replace rp_attack_ptran_sexor = -1 if attacked4==-1
replace rp_attack_ptran_sexor = -8 if attacked4==-8
label define rp_attack_ptran_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pub. trans." 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_ptran_sexor rp_attack_ptran_sexor
label variable rp_attack_ptran_sexor "attacked - public transportation; sexual orientation"

gen rp_attack_ptran_hlth = 2 if resattacked5_4==1 & attacked4==1
replace rp_attack_ptran_hlth = 1 if resattacked5_4==0 & attacked4==1
replace rp_attack_ptran_hlth =0 if attacked4==0
replace rp_attack_ptran_hlth = -1 if attacked4==-1
replace rp_attack_ptran_hlth = -8 if attacked4==-8
label define rp_attack_ptran_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pub. trans." 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_ptran_hlth rp_attack_ptran_hlth
label variable rp_attack_ptran_hlth "attacked - public transportation; health and disability"

gen rp_attack_ptran_nat = 2 if resattacked6_4==1 & attacked4==1
replace rp_attack_ptran_nat = 1 if resattacked6_4==0 & attacked4==1
replace rp_attack_ptran_nat =0 if attacked4==0
replace rp_attack_ptran_nat = -1 if attacked4==-1
replace rp_attack_ptran_nat = -8 if attacked4==-8
label define rp_attack_ptran_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pub. trans." 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_ptran_nat rp_attack_ptran_nat
label variable rp_attack_ptran_nat "attacked - public transportation; nationality"

gen rp_attack_ptran_rel = 2 if resattacked7_4==1 & attacked4==1
replace rp_attack_ptran_rel = 1 if resattacked7_4==0 & attacked4==1
replace rp_attack_ptran_rel =0 if attacked4==0
replace rp_attack_ptran_rel = -1 if attacked4==-1
replace rp_attack_ptran_rel = -8 if attacked4==-8
label define rp_attack_ptran_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pub. trans." 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_ptran_rel rp_attack_ptran_rel
label variable rp_attack_ptran_rel "attacked - public transportation; religion"

gen rp_attack_ptran_lang = 2 if resattacked8_4==1 & attacked4==1
replace rp_attack_ptran_lang = 1 if resattacked8_4==0 & attacked4==1
replace rp_attack_ptran_lang =0 if attacked4==0
replace rp_attack_ptran_lang = -1 if attacked4==-1
replace rp_attack_ptran_lang = -8 if attacked4==-8
label define rp_attack_ptran_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pub. trans." 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_ptran_lang rp_attack_ptran_lang
label variable rp_attack_ptran_lang "attacked - public transportation; language or accent"

gen rp_attack_ptran_drss = 2 if resattacked9_4==1 & attacked4==1
replace rp_attack_ptran_drss = 1 if resattacked9_4==0 & attacked4==1
replace rp_attack_ptran_drss =0 if attacked4==0
replace rp_attack_ptran_drss = -1 if attacked4==-1
replace rp_attack_ptran_drss = -8 if attacked4==-8
label define rp_attack_ptran_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pub. trans." 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_ptran_drss rp_attack_ptran_drss
label variable rp_attack_ptran_drss "attacked - public transportation; appearance or dress"

gen rp_attack_ptran_oth = 2 if resattacked96_4==1 & attacked4==1
replace rp_attack_ptran_oth = 1 if resattacked96_4==0 & attacked4==1
replace rp_attack_ptran_oth =0 if attacked4==0
replace rp_attack_ptran_oth = -1 if attacked4==-1
replace rp_attack_ptran_oth = -8 if attacked4==-8
label define rp_attack_ptran_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pub. trans." 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_ptran_oth rp_attack_ptran_oth
label variable rp_attack_ptran_oth "attacked - public transportation	; 'other reason'"
replace rp_attack_ptran_oth = 2 if resattacked97_4==1

* Bus/Train Station

gen rp_attack_btstn_sex = 2 if resattacked1_5==1 & attacked5==1
replace rp_attack_btstn_sex = 1 if resattacked1_5==0 & attacked5==1
replace rp_attack_btstn_sex =0 if attacked5==0
replace rp_attack_btstn_sex = -1 if attacked5==-1
replace rp_attack_btstn_sex = -8 if attacked5==-8
label define rp_attack_btstn_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: stations" 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_btstn_sex rp_attack_btstn_sex
label variable rp_attack_btstn_sex "attacked - bus/train stations; sex"

gen rp_attack_btstn_age = 2 if resattacked2_5==1 & attacked5==1
replace rp_attack_btstn_age = 1 if resattacked2_5==0 & attacked5==1
replace rp_attack_btstn_age =0 if attacked5==0
replace rp_attack_btstn_age = -1 if attacked5==-1
replace rp_attack_btstn_age = -8 if attacked5==-8
label define rp_attack_btstn_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: stations" 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_btstn_age rp_attack_btstn_age
label variable rp_attack_btstn_age "attacked - bus/train stations; age"

gen rp_attack_btstn_eth = 2 if resattacked3_5==1 & attacked5==1
replace rp_attack_btstn_eth = 1 if resattacked3_5==0 & attacked5==1
replace rp_attack_btstn_eth =0 if attacked5==0
replace rp_attack_btstn_eth = -1 if attacked5==-1
replace rp_attack_btstn_eth = -8 if attacked5==-8
label define rp_attack_btstn_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: stations" 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_btstn_eth rp_attack_btstn_eth
label variable rp_attack_btstn_eth "attacked - bus/train stations; ethnicity"

gen rp_attack_btstn_sexor = 2 if resattacked4_5==1 & attacked5==1
replace rp_attack_btstn_sexor = 1 if resattacked4_5==0 & attacked5==1
replace rp_attack_btstn_sexor =0 if attacked5==0
replace rp_attack_btstn_sexor = -1 if attacked5==-1
replace rp_attack_btstn_sexor = -8 if attacked5==-8
label define rp_attack_btstn_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: stations" 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_btstn_sexor rp_attack_btstn_sexor
label variable rp_attack_btstn_sexor "attacked - bus/train stations; sexual orientation"

gen rp_attack_btstn_hlth = 2 if resattacked5_5==1 & attacked5==1
replace rp_attack_btstn_hlth = 1 if resattacked5_5==0 & attacked5==1
replace rp_attack_btstn_hlth =0 if attacked5==0
replace rp_attack_btstn_hlth = -1 if attacked5==-1
replace rp_attack_btstn_hlth = -8 if attacked5==-8
label define rp_attack_btstn_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: stations" 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_btstn_hlth rp_attack_btstn_hlth
label variable rp_attack_btstn_hlth "attacked - bus/train stations; health and disability"

gen rp_attack_btstn_nat = 2 if resattacked6_5==1 & attacked5==1
replace rp_attack_btstn_nat = 1 if resattacked6_5==0 & attacked5==1
replace rp_attack_btstn_nat =0 if attacked5==0
replace rp_attack_btstn_nat = -1 if attacked5==-1
replace rp_attack_btstn_nat = -8 if attacked5==-8
label define rp_attack_btstn_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: stations" 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_btstn_nat rp_attack_btstn_nat
label variable rp_attack_btstn_nat "attacked - bus/train stations; nationality"

gen rp_attack_btstn_rel = 2 if resattacked7_5==1 & attacked5==1
replace rp_attack_btstn_rel = 1 if resattacked7_5==0 & attacked5==1
replace rp_attack_btstn_rel =0 if attacked5==0
replace rp_attack_btstn_rel = -1 if attacked5==-1
replace rp_attack_btstn_rel = -8 if attacked5==-8
label define rp_attack_btstn_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: stations" 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_btstn_rel rp_attack_btstn_rel
label variable rp_attack_btstn_rel "attacked - bus/train stations; religion"

gen rp_attack_btstn_lang = 2 if resattacked8_5==1 & attacked5==1
replace rp_attack_btstn_lang = 1 if resattacked8_5==0 & attacked5==1
replace rp_attack_btstn_lang =0 if attacked5==0
replace rp_attack_btstn_lang = -1 if attacked5==-1
replace rp_attack_btstn_lang = -8 if attacked5==-8
label define rp_attack_btstn_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: stations" 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_btstn_lang rp_attack_btstn_lang
label variable rp_attack_btstn_lang "attacked - bus/train stations; language or accent"

gen rp_attack_btstn_drss = 2 if resattacked9_5==1 & attacked5==1
replace rp_attack_btstn_drss = 1 if resattacked9_5==0 & attacked5==1
replace rp_attack_btstn_drss =0 if attacked5==0
replace rp_attack_btstn_drss = -1 if attacked5==-1
replace rp_attack_btstn_drss = -8 if attacked5==-8
label define rp_attack_btstn_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: stations" 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_btstn_drss rp_attack_btstn_drss
label variable rp_attack_btstn_drss "attacked - bus/train stations; appearance or dress"

gen rp_attack_btstn_oth = 2 if resattacked96_5==1 & attacked5==1
replace rp_attack_btstn_oth = 1 if resattacked96_5==0 & attacked5==1
replace rp_attack_btstn_oth =0 if attacked5==0
replace rp_attack_btstn_oth = -1 if attacked5==-1
replace rp_attack_btstn_oth = -8 if attacked5==-8
label define rp_attack_btstn_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: stations" 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_btstn_oth rp_attack_btstn_oth
label variable rp_attack_btstn_oth "attacked - bus/train stations; 'other reason'"
replace rp_attack_btstn_oth = 2 if resattacked97_5==1

* Shopping centres

gen rp_attack_shpc_sex = 2 if resattacked1_6==1 & attacked6==1
replace rp_attack_shpc_sex = 1 if resattacked1_6==0 & attacked6==1
replace rp_attack_shpc_sex =0 if attacked6==0
replace rp_attack_shpc_sex = -1 if attacked6==-1
replace rp_attack_shpc_sex = -8 if attacked6==-8
label define rp_attack_shpc_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: shopping, etc." 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_shpc_sex rp_attack_shpc_sex
label variable rp_attack_shpc_sex "attacked - shopping places; sex"

gen rp_attack_shpc_age = 2 if resattacked2_6==1 & attacked6==1
replace rp_attack_shpc_age = 1 if resattacked2_6==0 & attacked6==1
replace rp_attack_shpc_age =0 if attacked6==0
replace rp_attack_shpc_age = -1 if attacked6==-1
replace rp_attack_shpc_age = -8 if attacked6==-8
label define rp_attack_shpc_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: shopping, etc." 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_shpc_age rp_attack_shpc_age
label variable rp_attack_shpc_age "attacked - shopping places; age"

gen rp_attack_shpc_eth = 2 if resattacked3_6==1 & attacked6==1
replace rp_attack_shpc_eth = 1 if resattacked3_6==0 & attacked6==1
replace rp_attack_shpc_eth =0 if attacked6==0
replace rp_attack_shpc_eth = -1 if attacked6==-1
replace rp_attack_shpc_eth = -8 if attacked6==-8
label define rp_attack_shpc_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: shopping, etc." 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_shpc_eth rp_attack_shpc_eth
label variable rp_attack_shpc_eth "attacked - shopping places; ethnicity"

gen rp_attack_shpc_sexor = 2 if resattacked4_6==1 & attacked6==1
replace rp_attack_shpc_sexor = 1 if resattacked4_6==0 & attacked6==1
replace rp_attack_shpc_sexor =0 if attacked6==0
replace rp_attack_shpc_sexor = -1 if attacked6==-1
replace rp_attack_shpc_sexor = -8 if attacked6==-8
label define rp_attack_shpc_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: shopping, etc." 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_shpc_sexor rp_attack_shpc_sexor
label variable rp_attack_shpc_sexor "attacked - shopping places; sexual orientation"

gen rp_attack_shpc_hlth = 2 if resattacked5_6==1 & attacked6==1
replace rp_attack_shpc_hlth = 1 if resattacked5_6==0 & attacked6==1
replace rp_attack_shpc_hlth =0 if attacked6==0
replace rp_attack_shpc_hlth = -1 if attacked6==-1
replace rp_attack_shpc_hlth = -8 if attacked6==-8
label define rp_attack_shpc_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: shopping, etc." 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_shpc_hlth rp_attack_shpc_hlth
label variable rp_attack_shpc_hlth "attacked - shopping places; health and disability"

gen rp_attack_shpc_nat = 2 if resattacked6_6==1 & attacked6==1
replace rp_attack_shpc_nat = 1 if resattacked6_6==0 & attacked6==1
replace rp_attack_shpc_nat =0 if attacked6==0
replace rp_attack_shpc_nat = -1 if attacked6==-1
replace rp_attack_shpc_nat = -8 if attacked6==-8
label define rp_attack_shpc_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: shopping, etc." 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_shpc_nat rp_attack_shpc_nat
label variable rp_attack_shpc_nat "attacked - shopping places; nationality"

gen rp_attack_shpc_rel = 2 if resattacked7_6==1 & attacked6==1
replace rp_attack_shpc_rel = 1 if resattacked7_6==0 & attacked6==1
replace rp_attack_shpc_rel =0 if attacked6==0
replace rp_attack_shpc_rel = -1 if attacked6==-1
replace rp_attack_shpc_rel = -8 if attacked6==-8
label define rp_attack_shpc_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: shopping, etc." 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_shpc_rel rp_attack_shpc_rel
label variable rp_attack_shpc_rel "attacked - shopping places; religion"

gen rp_attack_shpc_lang = 2 if resattacked8_6==1 & attacked6==1
replace rp_attack_shpc_lang = 1 if resattacked8_6==0 & attacked6==1
replace rp_attack_shpc_lang =0 if attacked6==0
replace rp_attack_shpc_lang = -1 if attacked6==-1
replace rp_attack_shpc_lang = -8 if attacked6==-8
label define rp_attack_shpc_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: shopping, etc." 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_shpc_lang rp_attack_shpc_lang
label variable rp_attack_shpc_lang "attacked - shopping places; language or accent"

gen rp_attack_shpc_drss = 2 if resattacked9_6==1 & attacked6==1
replace rp_attack_shpc_drss = 1 if resattacked9_6==0 & attacked6==1
replace rp_attack_shpc_drss =0 if attacked6==0
replace rp_attack_shpc_drss = -1 if attacked6==-1
replace rp_attack_shpc_drss = -8 if attacked6==-8
label define rp_attack_shpc_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: shopping, etc." 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_shpc_drss rp_attack_shpc_drss
label variable rp_attack_shpc_drss "attacked - shopping places; appearance or dress"

gen rp_attack_shpc_oth = 2 if resattacked96_6==1 & attacked6==1
replace rp_attack_shpc_oth = 1 if resattacked96_6==0 & attacked6==1
replace rp_attack_shpc_oth =0 if attacked6==0
replace rp_attack_shpc_oth = -1 if attacked6==-1
replace rp_attack_shpc_oth = -8 if attacked6==-8
label define rp_attack_shpc_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: shopping, etc." 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_shpc_oth rp_attack_shpc_oth
label variable rp_attack_shpc_oth "attacked - shopping places; 'other reason'"
replace rp_attack_shpc_oth = 2 if resattacked97_6==1

* In cinema, cafes, etc

gen rp_attack_cincf_sex = 2 if resattacked1_7==1 & attacked7==1
replace rp_attack_cincf_sex = 1 if resattacked1_7==0 & attacked7==1
replace rp_attack_cincf_sex =0 if attacked7==0
replace rp_attack_cincf_sex = -1 if attacked7==-1
replace rp_attack_cincf_sex = -8 if attacked7==-8
label define rp_attack_cincf_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: cinemas, cafes, etc." 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_cincf_sex rp_attack_cincf_sex
label variable rp_attack_cincf_sex "attacked - cinema, cafes, etc.; sex"

gen rp_attack_cincf_age = 2 if resattacked2_7==1 & attacked7==1
replace rp_attack_cincf_age = 1 if resattacked2_7==0 & attacked7==1
replace rp_attack_cincf_age =0 if attacked7==0
replace rp_attack_cincf_age = -1 if attacked7==-1
replace rp_attack_cincf_age = -8 if attacked7==-8
label define rp_attack_cincf_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: cinemas, cafes, etc." 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_cincf_age rp_attack_cincf_age
label variable rp_attack_cincf_age "attacked - cinema, cafes, etc.; age"

gen rp_attack_cincf_eth = 2 if resattacked3_7==1 & attacked7==1
replace rp_attack_cincf_eth = 1 if resattacked3_7==0 & attacked7==1
replace rp_attack_cincf_eth =0 if attacked7==0
replace rp_attack_cincf_eth = -1 if attacked7==-1
replace rp_attack_cincf_eth = -8 if attacked7==-8
label define rp_attack_cincf_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: cinemas, cafes, etc." 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_cincf_eth rp_attack_cincf_eth
label variable rp_attack_cincf_eth "attacked - cinema, cafes, etc.; ethnicity"

gen rp_attack_cincf_sexor = 2 if resattacked4_7==1 & attacked7==1
replace rp_attack_cincf_sexor = 1 if resattacked4_7==0 & attacked7==1
replace rp_attack_cincf_sexor =0 if attacked7==0
replace rp_attack_cincf_sexor = -1 if attacked7==-1
replace rp_attack_cincf_sexor = -8 if attacked7==-8
label define rp_attack_cincf_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: cinemas, cafes, etc." 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_cincf_sexor rp_attack_cincf_sexor
label variable rp_attack_cincf_sexor "attacked - cinema, cafes, etc.; sexual orientation"

gen rp_attack_cincf_hlth = 2 if resattacked5_7==1 & attacked7==1
replace rp_attack_cincf_hlth = 1 if resattacked5_7==0 & attacked7==1
replace rp_attack_cincf_hlth =0 if attacked7==0
replace rp_attack_cincf_hlth = -1 if attacked7==-1
replace rp_attack_cincf_hlth = -8 if attacked7==-8
label define rp_attack_cincf_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: cinemas, cafes, etc." 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_cincf_hlth rp_attack_cincf_hlth
label variable rp_attack_cincf_hlth "attacked - cinema, cafes, etc.; health and disability"

gen rp_attack_cincf_nat = 2 if resattacked6_7==1 & attacked7==1
replace rp_attack_cincf_nat = 1 if resattacked6_7==0 & attacked7==1
replace rp_attack_cincf_nat =0 if attacked7==0
replace rp_attack_cincf_nat = -1 if attacked7==-1
replace rp_attack_cincf_nat = -8 if attacked7==-8
label define rp_attack_cincf_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: cinemas, cafes, etc." 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_cincf_nat rp_attack_cincf_nat
label variable rp_attack_cincf_nat "attacked - cinema, cafes, etc.; nationality"

gen rp_attack_cincf_rel = 2 if resattacked7_7==1 & attacked7==1
replace rp_attack_cincf_rel = 1 if resattacked7_7==0 & attacked7==1
replace rp_attack_cincf_rel =0 if attacked7==0
replace rp_attack_cincf_rel = -1 if attacked7==-1
replace rp_attack_cincf_rel = -8 if attacked7==-8
label define rp_attack_cincf_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: cinemas, cafes, etc." 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_cincf_rel rp_attack_cincf_rel
label variable rp_attack_cincf_rel "attacked - cinema, cafes, etc.; religion"

gen rp_attack_cincf_lang = 2 if resattacked8_7==1 & attacked7==1
replace rp_attack_cincf_lang = 1 if resattacked8_7==0 & attacked7==1
replace rp_attack_cincf_lang =0 if attacked7==0
replace rp_attack_cincf_lang = -1 if attacked7==-1
replace rp_attack_cincf_lang = -8 if attacked7==-8
label define rp_attack_cincf_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: cinemas, cafes, etc." 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_cincf_lang rp_attack_cincf_lang
label variable rp_attack_cincf_lang "attacked - cinema, cafes, etc.; language or accent"

gen rp_attack_cincf_drss = 2 if resattacked9_7==1 & attacked7==1
replace rp_attack_cincf_drss = 1 if resattacked9_7==0 & attacked7==1
replace rp_attack_cincf_drss =0 if attacked7==0
replace rp_attack_cincf_drss = -1 if attacked7==-1
replace rp_attack_cincf_drss = -8 if attacked7==-8
label define rp_attack_cincf_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: cinemas, cafes, etc." 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_cincf_drss rp_attack_cincf_drss
label variable rp_attack_cincf_drss "attacked - cinema, cafes, etc.; appearance or dress"

gen rp_attack_cincf_oth = 2 if resattacked96_7==1 & attacked7==1
replace rp_attack_cincf_oth = 1 if resattacked96_7==0 & attacked7==1
replace rp_attack_cincf_oth =0 if attacked7==0
replace rp_attack_cincf_oth = -1 if attacked7==-1
replace rp_attack_cincf_oth = -8 if attacked7==-8
label define rp_attack_cincf_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: cinemas, cafes, etc." 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_cincf_oth rp_attack_cincf_oth
label variable rp_attack_cincf_oth "attacked - cinema, cafes, etc.; 'other reason'"
replace rp_attack_cincf_oth = 2 if resattacked97_7==1

* Pubs, Discos, Night Clubs, etc.

gen rp_attack_nsoc_sex = 2 if resattacked1_8==1 & attacked8==1
replace rp_attack_nsoc_sex = 1 if resattacked1_8==0 & attacked8==1
replace rp_attack_nsoc_sex =0 if attacked8==0
replace rp_attack_nsoc_sex = -1 if attacked8==-1
replace rp_attack_nsoc_sex = -8 if attacked8==-8
label define rp_attack_nsoc_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pubs, clubs, etc." 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_nsoc_sex rp_attack_nsoc_sex
label variable rp_attack_nsoc_sex "attacked - Pubs, Clubs, Discos; sex"

gen rp_attack_nsoc_age = 2 if resattacked2_8==1 & attacked8==1
replace rp_attack_nsoc_age = 1 if resattacked2_8==0 & attacked8==1
replace rp_attack_nsoc_age =0 if attacked8==0
replace rp_attack_nsoc_age = -1 if attacked8==-1
replace rp_attack_nsoc_age = -8 if attacked8==-8
label define rp_attack_nsoc_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pubs, clubs, etc." 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_nsoc_age rp_attack_nsoc_age
label variable rp_attack_nsoc_age "attacked - Pubs, Clubs, Discos; age"

gen rp_attack_nsoc_eth = 2 if resattacked3_8==1 & attacked8==1
replace rp_attack_nsoc_eth = 1 if resattacked3_8==0 & attacked8==1
replace rp_attack_nsoc_eth =0 if attacked8==0
replace rp_attack_nsoc_eth = -1 if attacked8==-1
replace rp_attack_nsoc_eth = -8 if attacked8==-8
label define rp_attack_nsoc_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pubs, clubs, etc." 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_nsoc_eth rp_attack_nsoc_eth
label variable rp_attack_nsoc_eth "attacked - Pubs, Clubs, Discos; ethnicity"

gen rp_attack_nsoc_sexor = 2 if resattacked4_8==1 & attacked8==1
replace rp_attack_nsoc_sexor = 1 if resattacked4_8==0 & attacked8==1
replace rp_attack_nsoc_sexor =0 if attacked8==0
replace rp_attack_nsoc_sexor = -1 if attacked8==-1
replace rp_attack_nsoc_sexor = -8 if attacked8==-8
label define rp_attack_nsoc_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pubs, clubs, etc." 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_nsoc_sexor rp_attack_nsoc_sexor
label variable rp_attack_nsoc_sexor "attacked - Pubs, Clubs, Discos; sexual orientation"

gen rp_attack_nsoc_hlth = 2 if resattacked5_8==1 & attacked8==1
replace rp_attack_nsoc_hlth = 1 if resattacked5_8==0 & attacked8==1
replace rp_attack_nsoc_hlth =0 if attacked8==0
replace rp_attack_nsoc_hlth = -1 if attacked8==-1
replace rp_attack_nsoc_hlth = -8 if attacked8==-8
label define rp_attack_nsoc_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pubs, clubs, etc." 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_nsoc_hlth rp_attack_nsoc_hlth
label variable rp_attack_nsoc_hlth "attacked - Pubs, Clubs, Discos; health and disability"

gen rp_attack_nsoc_nat = 2 if resattacked6_8==1 & attacked8==1
replace rp_attack_nsoc_nat = 1 if resattacked6_8==0 & attacked8==1
replace rp_attack_nsoc_nat =0 if attacked8==0
replace rp_attack_nsoc_nat = -1 if attacked8==-1
replace rp_attack_nsoc_nat = -8 if attacked8==-8
label define rp_attack_nsoc_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pubs, clubs, etc." 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_nsoc_nat rp_attack_nsoc_nat
label variable rp_attack_nsoc_nat "attacked - Pubs, Clubs, Discos; nationality"

gen rp_attack_nsoc_rel = 2 if resattacked7_8==1 & attacked8==1
replace rp_attack_nsoc_rel = 1 if resattacked7_8==0 & attacked8==1
replace rp_attack_nsoc_rel =0 if attacked8==0
replace rp_attack_nsoc_rel = -1 if attacked8==-1
replace rp_attack_nsoc_rel = -8 if attacked8==-8
label define rp_attack_nsoc_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pubs, clubs, etc." 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_nsoc_rel rp_attack_nsoc_rel
label variable rp_attack_nsoc_rel "attacked - Pubs, Clubs, Discos; religion"

gen rp_attack_nsoc_lang = 2 if resattacked8_8==1 & attacked8==1
replace rp_attack_nsoc_lang = 1 if resattacked8_8==0 & attacked8==1
replace rp_attack_nsoc_lang =0 if attacked8==0
replace rp_attack_nsoc_lang = -1 if attacked8==-1
replace rp_attack_nsoc_lang = -8 if attacked8==-8
label define rp_attack_nsoc_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pubs, clubs, etc." 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_nsoc_lang rp_attack_nsoc_lang
label variable rp_attack_nsoc_lang "attacked - Pubs, Clubs, Discos; language or accent"

gen rp_attack_nsoc_drss = 2 if resattacked9_8==1 & attacked8==1
replace rp_attack_nsoc_drss = 1 if resattacked9_8==0 & attacked8==1
replace rp_attack_nsoc_drss =0 if attacked8==0
replace rp_attack_nsoc_drss = -1 if attacked8==-1
replace rp_attack_nsoc_drss = -8 if attacked8==-8
label define rp_attack_nsoc_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pubs, clubs, etc." 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_nsoc_drss rp_attack_nsoc_drss
label variable rp_attack_nsoc_drss "attacked - Pubs, Clubs, Discos; appearance or dress"

gen rp_attack_nsoc_oth = 2 if resattacked96_8==1 & attacked8==1
replace rp_attack_nsoc_oth = 1 if resattacked96_8==0 & attacked8==1
replace rp_attack_nsoc_oth =0 if attacked8==0
replace rp_attack_nsoc_oth = -1 if attacked8==-1
replace rp_attack_nsoc_oth = -8 if attacked8==-8
label define rp_attack_nsoc_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: pubs, clubs, etc." 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_nsoc_oth rp_attack_nsoc_oth
label variable rp_attack_nsoc_oth "attacked - Pubs, Clubs, Discos	; 'other reason'"
replace rp_attack_nsoc_oth = 2 if resattacked97_8==1

* Car Parks

gen rp_attack_cpark_sex = 2 if resattacked1_9==1 & attacked9==1
replace rp_attack_cpark_sex = 1 if resattacked1_9==0 & attacked9==1
replace rp_attack_cpark_sex =0 if attacked9==0
replace rp_attack_cpark_sex = -1 if attacked9==-1
replace rp_attack_cpark_sex = -8 if attacked9==-8
label define rp_attack_cpark_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: Car parks" 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_cpark_sex rp_attack_cpark_sex
label variable rp_attack_cpark_sex "attacked - Car Parks; sex"

gen rp_attack_cpark_age = 2 if resattacked2_9==1 & attacked9==1
replace rp_attack_cpark_age = 1 if resattacked2_9==0 & attacked9==1
replace rp_attack_cpark_age =0 if attacked9==0
replace rp_attack_cpark_age = -1 if attacked9==-1
replace rp_attack_cpark_age = -8 if attacked9==-8
label define rp_attack_cpark_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: Car parks" 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_cpark_age rp_attack_cpark_age
label variable rp_attack_cpark_age "attacked - Car Parks; age"

gen rp_attack_cpark_eth = 2 if resattacked3_9==1 & attacked9==1
replace rp_attack_cpark_eth = 1 if resattacked3_9==0 & attacked9==1
replace rp_attack_cpark_eth =0 if attacked9==0
replace rp_attack_cpark_eth = -1 if attacked9==-1
replace rp_attack_cpark_eth = -8 if attacked9==-8
label define rp_attack_cpark_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: Car parks" 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_cpark_eth rp_attack_cpark_eth
label variable rp_attack_cpark_eth "attacked - Car Parks; ethnicity"

gen rp_attack_cpark_sexor = 2 if resattacked4_9==1 & attacked9==1
replace rp_attack_cpark_sexor = 1 if resattacked4_9==0 & attacked9==1
replace rp_attack_cpark_sexor =0 if attacked9==0
replace rp_attack_cpark_sexor = -1 if attacked9==-1
replace rp_attack_cpark_sexor = -8 if attacked9==-8
label define rp_attack_cpark_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: Car parks" 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_cpark_sexor rp_attack_cpark_sexor
label variable rp_attack_cpark_sexor "attacked - Car Parks; sexual orientation"

gen rp_attack_cpark_hlth = 2 if resattacked5_9==1 & attacked9==1
replace rp_attack_cpark_hlth = 1 if resattacked5_9==0 & attacked9==1
replace rp_attack_cpark_hlth =0 if attacked9==0
replace rp_attack_cpark_hlth = -1 if attacked9==-1
replace rp_attack_cpark_hlth = -8 if attacked9==-8
label define rp_attack_cpark_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: Car parks" 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_cpark_hlth rp_attack_cpark_hlth
label variable rp_attack_cpark_hlth "attacked - Car Parks; health and disability"

gen rp_attack_cpark_nat = 2 if resattacked6_9==1 & attacked9==1
replace rp_attack_cpark_nat = 1 if resattacked6_9==0 & attacked9==1
replace rp_attack_cpark_nat =0 if attacked9==0
replace rp_attack_cpark_nat = -1 if attacked9==-1
replace rp_attack_cpark_nat = -8 if attacked9==-8
label define rp_attack_cpark_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: Car parks" 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_cpark_nat rp_attack_cpark_nat
label variable rp_attack_cpark_nat "attacked - Car Parks; nationality"

gen rp_attack_cpark_rel = 2 if resattacked7_9==1 & attacked9==1
replace rp_attack_cpark_rel = 1 if resattacked7_9==0 & attacked9==1
replace rp_attack_cpark_rel =0 if attacked9==0
replace rp_attack_cpark_rel = -1 if attacked9==-1
replace rp_attack_cpark_rel = -8 if attacked9==-8
label define rp_attack_cpark_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: Car parks" 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_cpark_rel rp_attack_cpark_rel
label variable rp_attack_cpark_rel "attacked - Car Parks; religion"

gen rp_attack_cpark_lang = 2 if resattacked8_9==1 & attacked9==1
replace rp_attack_cpark_lang = 1 if resattacked8_9==0 & attacked9==1
replace rp_attack_cpark_lang =0 if attacked9==0
replace rp_attack_cpark_lang = -1 if attacked9==-1
replace rp_attack_cpark_lang = -8 if attacked9==-8
label define rp_attack_cpark_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: Car parks" 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_cpark_lang rp_attack_cpark_lang
label variable rp_attack_cpark_lang "attacked - Car Parks; language or accent"

gen rp_attack_cpark_drss = 2 if resattacked9_9==1 & attacked9==1
replace rp_attack_cpark_drss = 1 if resattacked9_9==0 & attacked9==1
replace rp_attack_cpark_drss =0 if attacked9==0
replace rp_attack_cpark_drss = -1 if attacked9==-1
replace rp_attack_cpark_drss = -8 if attacked9==-8
label define rp_attack_cpark_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: Car parks" 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_cpark_drss rp_attack_cpark_drss
label variable rp_attack_cpark_drss "attacked - Car Parks; appearance or dress"

gen rp_attack_cpark_oth = 2 if resattacked96_9==1 & attacked9==1
replace rp_attack_cpark_oth = 1 if resattacked96_9==0 & attacked9==1
replace rp_attack_cpark_oth =0 if attacked9==0
replace rp_attack_cpark_oth = -1 if attacked9==-1
replace rp_attack_cpark_oth = -8 if attacked9==-8
label define rp_attack_cpark_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: Car parks" 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_cpark_oth rp_attack_cpark_oth
label variable rp_attack_cpark_oth "attacked - Car Parks; 'other reason'"
replace rp_attack_cpark_oth = 2 if resattacked97_9==1

* Outside (streets/parks)

gen rp_attack_out_sex = 2 if resattacked1_10==1 & attacked10==1
replace rp_attack_out_sex = 1 if resattacked1_10==0 & attacked10==1
replace rp_attack_out_sex =0 if attacked10==0
replace rp_attack_out_sex = -1 if attacked10==-1
replace rp_attack_out_sex = -8 if attacked10==-8
label define rp_attack_out_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: outside (streets, parks, etc.)" 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_out_sex rp_attack_out_sex
label variable rp_attack_out_sex "attacked - outside (streets, parks, etc.); sex"

gen rp_attack_out_age = 2 if resattacked2_10==1 & attacked10==1
replace rp_attack_out_age = 1 if resattacked2_10==0 & attacked10==1
replace rp_attack_out_age =0 if attacked10==0
replace rp_attack_out_age = -1 if attacked10==-1
replace rp_attack_out_age = -8 if attacked10==-8
label define rp_attack_out_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: outside (streets, parks, etc.)" 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_out_age rp_attack_out_age
label variable rp_attack_out_age "attacked - outside (streets, parks, etc.); age"

gen rp_attack_out_eth = 2 if resattacked3_10==1 & attacked10==1
replace rp_attack_out_eth = 1 if resattacked3_10==0 & attacked10==1
replace rp_attack_out_eth =0 if attacked10==0
replace rp_attack_out_eth = -1 if attacked10==-1
replace rp_attack_out_eth = -8 if attacked10==-8
label define rp_attack_out_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: outside (streets, parks, etc.)" 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_out_eth rp_attack_out_eth
label variable rp_attack_out_eth "attacked - outside (streets, parks, etc.); ethnicity"

gen rp_attack_out_sexor = 2 if resattacked4_10==1 & attacked10==1
replace rp_attack_out_sexor = 1 if resattacked4_10==0 & attacked10==1
replace rp_attack_out_sexor =0 if attacked10==0
replace rp_attack_out_sexor = -1 if attacked10==-1
replace rp_attack_out_sexor = -8 if attacked10==-8
label define rp_attack_out_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: outside (streets, parks, etc.)" 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_out_sexor rp_attack_out_sexor
label variable rp_attack_out_sexor "attacked - outside (streets, parks, etc.); sexual orientation"

gen rp_attack_out_hlth = 2 if resattacked5_10==1 & attacked10==1
replace rp_attack_out_hlth = 1 if resattacked5_10==0 & attacked10==1
replace rp_attack_out_hlth =0 if attacked10==0
replace rp_attack_out_hlth = -1 if attacked10==-1
replace rp_attack_out_hlth = -8 if attacked10==-8
label define rp_attack_out_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: outside (streets, parks, etc.)" 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_out_hlth rp_attack_out_hlth
label variable rp_attack_out_hlth "attacked - outside (streets, parks, etc.); health and disability"

gen rp_attack_out_nat = 2 if resattacked6_10==1 & attacked10==1
replace rp_attack_out_nat = 1 if resattacked6_10==0 & attacked10==1
replace rp_attack_out_nat =0 if attacked10==0
replace rp_attack_out_nat = -1 if attacked10==-1
replace rp_attack_out_nat = -8 if attacked10==-8
label define rp_attack_out_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: outside (streets, parks, etc.)" 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_out_nat rp_attack_out_nat
label variable rp_attack_out_nat "attacked - outside (streets, parks, etc.); nationality"

gen rp_attack_out_rel = 2 if resattacked7_10==1 & attacked10==1
replace rp_attack_out_rel = 1 if resattacked7_10==0 & attacked10==1
replace rp_attack_out_rel =0 if attacked10==0
replace rp_attack_out_rel = -1 if attacked10==-1
replace rp_attack_out_rel = -8 if attacked10==-8
label define rp_attack_out_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: outside (streets, parks, etc.)" 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_out_rel rp_attack_out_rel
label variable rp_attack_out_rel "attacked - outside (streets, parks, etc.); religion"

gen rp_attack_out_lang = 2 if resattacked8_10==1 & attacked10==1
replace rp_attack_out_lang = 1 if resattacked8_10==0 & attacked10==1
replace rp_attack_out_lang =0 if attacked10==0
replace rp_attack_out_lang = -1 if attacked10==-1
replace rp_attack_out_lang = -8 if attacked10==-8
label define rp_attack_out_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: outside (streets, parks, etc.)" 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_out_lang rp_attack_out_lang
label variable rp_attack_out_lang "attacked - outside (streets, parks, etc.); language or accent"

gen rp_attack_out_drss = 2 if resattacked9_10==1 & attacked10==1
replace rp_attack_out_drss = 1 if resattacked9_10==0 & attacked10==1
replace rp_attack_out_drss =0 if attacked10==0
replace rp_attack_out_drss = -1 if attacked10==-1
replace rp_attack_out_drss = -8 if attacked10==-8
label define rp_attack_out_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: outside (streets, parks, etc.)" 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_out_drss rp_attack_out_drss
label variable rp_attack_out_drss "attacked - outside (streets, parks, etc.); appearance or dress"

gen rp_attack_out_oth = 2 if resattacked96_10==1 & attacked10==1
replace rp_attack_out_oth = 1 if resattacked96_10==0 & attacked10==1
replace rp_attack_out_oth =0 if attacked10==0
replace rp_attack_out_oth = -1 if attacked10==-1
replace rp_attack_out_oth = -8 if attacked10==-8
label define rp_attack_out_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: outside (streets, parks, etc.)" 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_out_oth rp_attack_out_oth
label variable rp_attack_out_oth "attacked - outside (streets, parks, etc.); 'other reason'"
replace rp_attack_out_oth = 2 if resattacked97_10==1

* Home

gen rp_attack_home_sex = 2 if resattacked1_11==1 & attacked11==1
replace rp_attack_home_sex = 1 if resattacked1_11==0 & attacked11==1
replace rp_attack_home_sex =0 if attacked11==0
replace rp_attack_home_sex = -1 if attacked11==-1
replace rp_attack_home_sex = -8 if attacked11==-8
label define rp_attack_home_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: at home" 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_home_sex rp_attack_home_sex
label variable rp_attack_home_sex "attacked - at home; sex"

gen rp_attack_home_age = 2 if resattacked2_11==1 & attacked11==1
replace rp_attack_home_age = 1 if resattacked2_11==0 & attacked11==1
replace rp_attack_home_age =0 if attacked11==0
replace rp_attack_home_age = -1 if attacked11==-1
replace rp_attack_home_age = -8 if attacked11==-8
label define rp_attack_home_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: at home" 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_home_age rp_attack_home_age
label variable rp_attack_home_age "attacked - at home; age"

gen rp_attack_home_eth = 2 if resattacked3_11==1 & attacked11==1
replace rp_attack_home_eth = 1 if resattacked3_11==0 & attacked11==1
replace rp_attack_home_eth =0 if attacked11==0
replace rp_attack_home_eth = -1 if attacked11==-1
replace rp_attack_home_eth = -8 if attacked11==-8
label define rp_attack_home_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: at home" 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_home_eth rp_attack_home_eth
label variable rp_attack_home_eth "attacked - at home; ethnicity"

gen rp_attack_home_sexor = 2 if resattacked4_11==1 & attacked11==1
replace rp_attack_home_sexor = 1 if resattacked4_11==0 & attacked11==1
replace rp_attack_home_sexor =0 if attacked11==0
replace rp_attack_home_sexor = -1 if attacked11==-1
replace rp_attack_home_sexor = -8 if attacked11==-8
label define rp_attack_home_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: at home" 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_home_sexor rp_attack_home_sexor
label variable rp_attack_home_sexor "attacked - at home; sexual orientation"

gen rp_attack_home_hlth = 2 if resattacked5_11==1 & attacked11==1
replace rp_attack_home_hlth = 1 if resattacked5_11==0 & attacked11==1
replace rp_attack_home_hlth =0 if attacked11==0
replace rp_attack_home_hlth = -1 if attacked11==-1
replace rp_attack_home_hlth = -8 if attacked11==-8
label define rp_attack_home_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: at home" 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_home_hlth rp_attack_home_hlth
label variable rp_attack_home_hlth "attacked - at home; health and disability"

gen rp_attack_home_nat = 2 if resattacked6_11==1 & attacked11==1
replace rp_attack_home_nat = 1 if resattacked6_11==0 & attacked11==1
replace rp_attack_home_nat =0 if attacked11==0
replace rp_attack_home_nat = -1 if attacked11==-1
replace rp_attack_home_nat = -8 if attacked11==-8
label define rp_attack_home_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: at home" 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_home_nat rp_attack_home_nat
label variable rp_attack_home_nat "attacked - at home; nationality"

gen rp_attack_home_rel = 2 if resattacked7_11==1 & attacked11==1
replace rp_attack_home_rel = 1 if resattacked7_11==0 & attacked11==1
replace rp_attack_home_rel =0 if attacked11==0
replace rp_attack_home_rel = -1 if attacked11==-1
replace rp_attack_home_rel = -8 if attacked11==-8
label define rp_attack_home_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: at home" 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_home_rel rp_attack_home_rel
label variable rp_attack_home_rel "attacked - at home; religion"

gen rp_attack_home_lang = 2 if resattacked8_11==1 & attacked11==1
replace rp_attack_home_lang = 1 if resattacked8_11==0 & attacked11==1
replace rp_attack_home_lang =0 if attacked11==0
replace rp_attack_home_lang = -1 if attacked11==-1
replace rp_attack_home_lang = -8 if attacked11==-8
label define rp_attack_home_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: at home" 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_home_lang rp_attack_home_lang
label variable rp_attack_home_lang "attacked - at home; language or accent"

gen rp_attack_home_drss = 2 if resattacked9_11==1 & attacked11==1
replace rp_attack_home_drss = 1 if resattacked9_11==0 & attacked11==1
replace rp_attack_home_drss =0 if attacked11==0
replace rp_attack_home_drss = -1 if attacked11==-1
replace rp_attack_home_drss = -8 if attacked11==-8
label define rp_attack_home_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: at home" 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_home_drss rp_attack_home_drss
label variable rp_attack_home_drss "attacked - at home; appearance or dress"

gen rp_attack_home_oth = 2 if resattacked96_11==1 & attacked11==1
replace rp_attack_home_oth = 1 if resattacked96_11==0 & attacked11==1
replace rp_attack_home_oth =0 if attacked11==0
replace rp_attack_home_oth = -1 if attacked11==-1
replace rp_attack_home_oth = -8 if attacked11==-8
label define rp_attack_home_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: at home" 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_home_oth rp_attack_home_oth
label variable rp_attack_home_oth "attacked - at home; 'other reason'"
replace rp_attack_home_oth = 2 if resattacked97_11==1

* Other

gen rp_attack_other_sex = 2 if resattacked1_12==1 & p_attack_other==1
replace rp_attack_other_sex = 1 if resattacked1_12==0 & p_attack_other==1
replace rp_attack_other_sex =0 if p_attack_other==0
replace rp_attack_other_sex = -1 if p_attack_other==-1
replace rp_attack_other_sex = -8 if p_attack_other==-8
label define rp_attack_other_sex -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: other place" 1 "attacked: not sex" 2 "attacked: sex", modify
label values rp_attack_other_sex rp_attack_other_sex
label variable rp_attack_other_sex "attacked - other place; sex"

gen rp_attack_other_age = 2 if resattacked2_12==1 & p_attack_other==1
replace rp_attack_other_age = 1 if resattacked2_12==0 & p_attack_other==1
replace rp_attack_other_age =0 if p_attack_other==0
replace rp_attack_other_age = -1 if p_attack_other==-1
replace rp_attack_other_age = -8 if p_attack_other==-8
label define rp_attack_other_age -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: other place" 1 "attacked: not age" 2 "attacked: age", modify
label values rp_attack_other_age rp_attack_other_age
label variable rp_attack_other_age "attacked - other place; age"

gen rp_attack_other_eth = 2 if resattacked3_12==1 & p_attack_other==1
replace rp_attack_other_eth = 1 if resattacked3_12==0 & p_attack_other==1
replace rp_attack_other_eth =0 if p_attack_other==0
replace rp_attack_other_eth = -1 if p_attack_other==-1
replace rp_attack_other_eth = -8 if p_attack_other==-8
label define rp_attack_other_eth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: other place" 1 "attacked: not ethnicity" 2 "attacked: ethnicity", modify
label values rp_attack_other_eth rp_attack_other_eth
label variable rp_attack_other_eth "attacked - other place; ethnicity"

gen rp_attack_other_sexor = 2 if resattacked4_12==1 & p_attack_other==1
replace rp_attack_other_sexor = 1 if resattacked4_12==0 & p_attack_other==1
replace rp_attack_other_sexor =0 if p_attack_other==0
replace rp_attack_other_sexor = -1 if p_attack_other==-1
replace rp_attack_other_sexor = -8 if p_attack_other==-8
label define rp_attack_other_sexor -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: other place" 1 "attacked: not sexual orientation" 2 "attacked: sexual orientation", modify
label values rp_attack_other_sexor rp_attack_other_sexor
label variable rp_attack_other_sexor "attacked - other place; sexual orientation"

gen rp_attack_other_hlth = 2 if resattacked5_12==1 & p_attack_other==1
replace rp_attack_other_hlth = 1 if resattacked5_12==0 & p_attack_other==1
replace rp_attack_other_hlth =0 if p_attack_other==0
replace rp_attack_other_hlth = -1 if p_attack_other==-1
replace rp_attack_other_hlth = -8 if p_attack_other==-8
label define rp_attack_other_hlth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: other place" 1 "attacked: not health and disability" 2 "attacked: health and disability", modify
label values rp_attack_other_hlth rp_attack_other_hlth
label variable rp_attack_other_hlth "attacked - other place; health and disability"

gen rp_attack_other_nat = 2 if resattacked6_12==1 & p_attack_other==1
replace rp_attack_other_nat = 1 if resattacked6_12==0 & p_attack_other==1
replace rp_attack_other_nat =0 if p_attack_other==0
replace rp_attack_other_nat = -1 if p_attack_other==-1
replace rp_attack_other_nat = -8 if p_attack_other==-8
label define rp_attack_other_nat -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: other place" 1 "attacked: not nationality" 2 "attacked: nationality", modify
label values rp_attack_other_nat rp_attack_other_nat
label variable rp_attack_other_nat "attacked - other place; nationality"

gen rp_attack_other_rel = 2 if resattacked7_12==1 & p_attack_other==1
replace rp_attack_other_rel = 1 if resattacked7_12==0 & p_attack_other==1
replace rp_attack_other_rel =0 if p_attack_other==0
replace rp_attack_other_rel = -1 if p_attack_other==-1
replace rp_attack_other_rel = -8 if p_attack_other==-8
label define rp_attack_other_rel -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: other place" 1 "attacked: not religion" 2 "attacked: religion", modify
label values rp_attack_other_rel rp_attack_other_rel
label variable rp_attack_other_rel "attacked - other place; religion"

gen rp_attack_other_lang = 2 if resattacked8_12==1 & p_attack_other==1
replace rp_attack_other_lang = 1 if resattacked8_12==0 & p_attack_other==1
replace rp_attack_other_lang =0 if p_attack_other==0
replace rp_attack_other_lang = -1 if p_attack_other==-1
replace rp_attack_other_lang = -8 if p_attack_other==-8
label define rp_attack_other_lang -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: other place" 1 "attacked: not language or accent" 2 "attacked: language or accent", modify
label values rp_attack_other_lang rp_attack_other_lang
label variable rp_attack_other_lang "attacked - other place; language or accent"

gen rp_attack_other_drss = 2 if resattacked9_12==1 & p_attack_other==1
replace rp_attack_other_drss = 1 if resattacked9_12==0 & p_attack_other==1
replace rp_attack_other_drss =0 if p_attack_other==0
replace rp_attack_other_drss = -1 if p_attack_other==-1
replace rp_attack_other_drss = -8 if p_attack_other==-8
label define rp_attack_other_drss -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: other place" 1 "attacked: not appearance or dress" 2 "attacked: appearance or dress", modify
label values rp_attack_other_drss rp_attack_other_drss
label variable rp_attack_other_drss "attacked - other place; appearance or dress"

gen rp_attack_other_oth = 2 if resattacked96_12==1 & p_attack_other==1
replace rp_attack_other_oth = 1 if resattacked96_12==0 & p_attack_other==1
replace rp_attack_other_oth =0 if p_attack_other==0
replace rp_attack_other_oth = -1 if p_attack_other==-1
replace rp_attack_other_oth = -8 if p_attack_other==-8
label define rp_attack_other_oth -8 "Inapplicable" -1 "Don't know" 0 "Not attacked: other place" 1 "attacked: not 'other reason'" 2 "attacked: 'other reason'", modify
label values rp_attack_other_oth rp_attack_other_oth
label variable rp_attack_other_oth "attacked - other place; 'other reason'"
replace rp_attack_other_oth = 2 if resattacked97_12==1

********************************************************************************

save "...temp\usoc_harass.dta", replace

***********************************
***********************************
********* BREXIT ANALYSIS *********
***********************************
***********************************

* EU Referendum opinion: "Should the United Kingdom remain a member of the 
* European Union or leave the European Union?"

clonevar euref_w8 = h_eumem 

* Country of residence and dropping Northern Ireland

clonevar country_w8 = h_country
drop if country_w==4

* Education (highest qualification)

clonevar quals_w8 = h_qfhigh_dv

* Age 

clonevar age_w8 = h_age_dv  

* Sex

clonevar sex_w8 = h_sex_dv

* Social class

clonevar socclass_w8 = h_jbnssec8_dv 

* Ethnic group

rename h_racel_dv ethnic_w8

* Region

clonevar region_w8 = h_gor_dv

* Employment

clonevar empstat_w8 = h_ff_jbstat

* Subjective financial situation - current

clonevar finsit_w8 = h_finnow 

* Subjective financial situation - future

clonevar fufinsit_w8 = h_finfut  

* Country of birth

clonevar ukborn_w8 = bornuk_dv 

* Keeping variables for initial analysis