Location of Rape

Iowa Department of Public Safety

Download SPSS syntax
Download Table Template file

This example looks at the location of rape incidents in Iowa.  To create this chart, all rape incidents were selected, and a frequency of location was run, with the results presented in a pie chart.  When using this code, be sure to insert the path and the file name of the data file to be used, as well as the directory and file name for saving.  If you need any assistance working with the syntax provided, please contact us.

NOTE: This example requires that you download a template file before running the syntax.

The assumptions for the following example of code are:
  1. The data file was created as described in "Reading A Multi-Level Data File."
  2. An aggregated flat file was created as described in "Creating An Incident-Level Aggregated Flat File in SPSS"; and
  3. The individual data segments were saved in separate files as described in "Creating An Incident-Level Aggregated Flat File in SPSS".

Preparing the File.  The unit of analysis for this research question is incident.  The incident-level flat file can be used rather than multiple segments (administrative, victim, offense) because the variables needed were created with the aggregate command in the Creating An Incident-Level Aggregated Flat File procedure (see above).  The SELECT IF chooses records if the most serious offense is equal to 110 (rape).  The RECODE groups the values for the variable incident location into six numeric categories and names the new variable 'location'.  VALUE LABELS assigns a descriptive label to each numerical value for the new variable.

GET FILE='Directory\Path\Incident 1999.sav'.
SELECT IF (msioff = 110).
RECODE inc_loc
  (20 = 1)(2,3,5,7,9,12,17,21,23,24 = 2)(13,18 = 3)(14,22 = 4)(10,16 = 5)(else = 6)INTO location.
VARIABLE LABELS location 'Location'.
1 'Residence'  2 'Commercial Bldg'  3 'Hwy/Road/Garage'  4 'Hotel/Motel/School'  5 'Park/Field/Lake'
6 'Other/Unknown'.

Creating the Output.  This output is defined as a simple pie chart that displays the percent of rapes by location.  We also use a previously defined template for formatting the chart.

  /PIE=PCT BY location
  /TEMPLATE='Directory\Path\Table7 template.sct'
  /TITLE='Location of Rape'.

The resulting pie chart looks like this:

location_rape.jpg (42518 bytes)