* this is the code that was used to transform the full ICVS/EUICS data set into the country-year data used in the paper
* the full data are available at http://easy.dans.knaw.nl, database ID P1749.

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

* drop observations from Scotland, Northern Ireland, and England and Wales, respectively, as these were combined into a UK observation (except England 1992, which is here dropped completely) (email from John van Kesteren of 28 November 2008)

drop if I005A==450 | I005A==380 | I005A==180 

* keep only the variables that I will actually use
// crimes: the ten crimes consistent over all five sweeps as in the 2004-05 report (table 1 on p. 237 and the SPSS syntax victim(…) included in the download), minus sexual assault
// weights: The official ICVS 2004-05 report (pp. 191-2) explains that individual weights are household weights plus additional regional and age adjustments. Hence they use individual weights. So do I. Among the various individual weights, I use the generic one (w005A) corresponding to the use of the full data set (cf. Code Book, pp. 10-11 of the pdf file), rather than the special weights for the national surveys (w005B) and the main city surveys (w004A). In any event, the effect of the choice between the generic and special weights is minor because within almost each country / year / survey-type combination (i.e., the unit I collapse the data into), w005A is perfectly correlated with w004A and w005B, as the case may be. The only two exceptions are Cambodia and Latvia in the 4th sweep, for which w004A is not perfectly correlated with w005A (rho equal to 0.32 and 0.69, respectively). Using the special weights instead would lose national data for Argentina (2,731 obs.) and Peru (3,289 obs.) in the 5th sweep (cf. note at the end of this code) because only their city observations have been assigned a special weight (W004A). In addition to these Argentinian and Peruvian observations, there are 5,833 other observations from 16 countries that do not have special weights, almost all of them from the 3rd sweep and apparently (judging by the numbers) for the purpose of holding the sample size per country constant at around 1,000. These countries are (number of observations in parentheses, all from 3rd sweep unless otherwise noted): Albania (217), Australia (1,001, 5th), Bolivia (401), Costa Rica (299), India (201), Indonesia (700), Kyrgyzstan (758), Latvia (399), Lithuania (2), Mongolia (147), New Zealand (22, 5th), Philippines (1,442), Rumania (91), Slovenia (1, 4th), South Africa (2, 5th), Uganda (200).

keep  I002  I002A  I003  I005A  I009 I010  W005A C01A100 C02A100 C04A100 C05A100 C06A100 C07A100 C09A100 C10A100 C11A100 C12A100 K040


* some random clean-up
// EUICS data has year =2005.1 and sweep=5.1; set this to 2005 and 5, respectively (EUICS data can still be identified by I009)

recode I002 (2005.1=2005)
recode I002A (5.1=5)

// some surveys seem to have modifications of the standard survey instruments; I dispense with these details and treat them the same as the survey instrument they were based on

replace  I009= I010 if mi( I009)==1
drop I010

// I002A doesn't have a label

label variable  I002A sweep

// Burglary data (C06A100) for Lithuania’s 5th sweep was obviously miscoded. Lithuania has 2000 observations per crime in the 5th sweep, except for burglary, for which it has only 190, all of which are “this year,” “last year,” or “before that,” or “9” [11 observations]). It seems that all answers of “no victim” and “don’t know” were coded as missing values. To correct this, I recode missing values as “no victim.” Note that this correction does not matter if one treats missing values as “no victim,” as the official ICVS SPSS syntax does (more on this below).

recode C06A100 (.=0) if I002A==5 & I005A==320

// Mozambique and Spain both had (only) main city surveys in 2000 (cf. code book’s lists of main city and national surveys), but are (erroneously) coded as “other” survey type in ICVS

replace  I003=2 if  I005A==352 | (I005A==490 &  I002A==4)


* cleaning the crime variables

// setting “no owner” (car, bike, motorbike) to “no victim” after creating special variables (“owner_...”) just for owners

foreach ownervar of varlist C01A100 C02A100 C04A100 C05A100 {
recode `ownervar' (-1=.), gen(owner_`ownervar')
recode `ownervar' (-1=0)
}

// victimization variables become binary (relevant year is last year (2), cf. SPSS syntax above)
// I code "don't know" as no victim, as the ICVS authors do (cf. SPSS syntax above). This has a large effect for burglary and attempted burglary in Belarus (4th sweep), because almost all respondents replied "don't know" according to the official ICVS data, with the only others reporting victimization in the last year.
// recoding “else” as missing affects only 11 observations from Lithuania’s 5th sweep, which have the undefined value “9” on C06A100 (burglary). The SPSS syntax referenced above does not count these observations as missing and hence effectively treats these observations as “no victim.” But since “9” has no interpretation, coding as missing seems the more principled choice.

recode C* owner* (0 1 3 4 = 0) (2=1) (else=.)
replace C11A100=. if K040!=2 // this keeps sex offenses only if interviewed was female; this was not consistent across surveys
drop K040



* creating a 9-crime one-year (the last year) victimization rate
// Treatment of missing values: The code for the main victim9 variable below creates missing values for any observation that has a missing value for any of the nine components. By contrast, the official ICVS SPSS code seems to include all observations and treat missing values as “no victim.” For comparison purposes, I therefore also calculate a vic9all variable that does the same. This makes a huge difference for Estonia’s 4th and 5th sweep, Peru, and Tanzania, which completely lack data on motorcycle theft, assault, and robbery and burglary, respectively. Outside these three countries, only about 3,000 observations (less than one percent of the data) have missing values for any of the 9 crimes.

egen vic9all=anymatch(C*), values(1)

gen victim9= C01A100 + C02A100 + C04A100 + C05A100 + C06A100 + C07A100 + C09A100 + C10A100 + C12A100
recode victim9 (1/9=1)


****** creating the country/year dataset ******

// weighting: a few countries’ weights don’t average 1 (e.g., US in the 5th sweep because of smaller sample size, cf. email from John van Kesteren of 28 November 2008), but this does not matter because STATA automatically rescales the weights so that they add to 1

collapse C* owner* victim9 vic9all [pw= W005A], by( I*)

// labelling

label data "ICVS, all five sweeps: victimization rates by country and year"
label variable  C01A100 "car theft, one-year victimization rate"
label variable  C02A100 "theft from car, one-year victimization rate"
label variable  C04A100 "motorcycle theft, one-year victimization rate"
label variable  C05A100 "bicycle theft, one-year victimization rate"
label variable  C06A100 "burglary, one-year victimization rate"
label variable  C07A100 "attempted burglary, one-year victimization rate"
label variable  C09A100 "robbery, one-year victimization rate"
label variable  C10A100 "theft of personal property, one-year victimization rate"
label variable  C11A100 "sex offenses, one-year victimization rate"
label variable  C12A100 "assault, one-year victimization rate"
label variable  owner_C01A100 "owners only: car theft, one-year victimization rate"
label variable  owner_C02A100 "owners only: theft from car, one-year victimization rate"
label variable  owner_C04A100 "owners only: motorcycle theft, one-year victimization rate"
label variable  owner_C05A100 "owners only: bicycle theft, one-year victimization rate"
label variable  victim9 "one-year victimization rate from 9 common crimes"
label variable  vic9all "same as victim9, but counting missing values as no victim"

// counting the number of sweeps for each country (for weighting later)

bysort I005A: egen sweeps=count(victim9)
label variable sweeps "number of sweeps of the country including victim9"

// merge preparation
merge m:1 I005A using countrycodes.dta, keep(1 3)nogenerate // will need to put in appropriate path here or earlier (using cd)
gen year=I002
drop if year==2000 & I005A==420 & I003==2 // this drops the Polish capital survey for 2000 because there is also a national survey

// Done!

* Note 1: this creates more data points, in particular more national data poinst, then in the official reports. The official report does not report some countries at all, and reports only city data for others, even though national data is available:
// Countries which are not officially reported at all: Lithuania (has national report data for the 5th sweep that is not reported in the official report or even mentioned in the codebook).
// Countries which are officially only reported as cities: Argentina, Peru, and Hong Kong. The codebook does mention that Argentina and Peru have more data in the 5th sweep than the city data reported in the official report; while these data are not marked as "national survey" under I005B, they are marked as such under I003. Hong Kong is not marked as national report under I005B but it is marked as such under I003; as a city state, the city observations reported in the code book exhaust the population.

* Note 2: I have verified that outlier observations for individual crimes indeed reflect high victimization reports, rather than a glitch in the data or the code. In particular, Argentina, Cambodia, and China had a very high incidence of reports of cars, motorcycles, and bicycles, respectively.
