Temporal Distribution of Sexual Assault Within Victim Age Categories

Howard N. Snyder, National Center for Juvenile Justice

Download SPSS syntax
Download SPSS Table Template

This example looks at the time of day sexual assault incidents occur across four victim age categories.  To illustrate the contrasting times of victimization for different age groups, victims are grouped into age categories.  Once sexual assault offenses are selected, bar charts are created.  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 file references a table template file which should be downloaded prior to 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 the victim.  To provide incident-level details, the incident-level flat file is merged with the victim segment.   The COMPUTE creates the variable sex_aslt and sets its value at zero.  The IF transformation selects all cases where the most serious incident offense is equal to a value of 110 (forcible rape) or a value of 180 through 183 (all other sex assault offenses).  The number 1 represents the presence of a sexual assault and the number 0 represents the absence of a sexual assault.

GET FILE='Directory\Path\victim segment 1999.sav'.
COMPUTE sex_aslt = 0.
IF (msvoff = 110 or msvoff = 180 or msvoff = 181 or msvoff = 182 or msvoff = 183)sex_aslt = 1.
FREQ sex_aslt.

The SELECT IF chooses all cases in which the variable sex_aslt is equal to a value of 1.  These incidents are saved to a new file, sex_aslt.sav.  The SAVE command KEEPS only those variables needed to complete the analysis.

SELECT IF (sex_aslt = 1).
SAVE OUTFILE = 'Directory\Path\sex_aslt.sav'/keep = ori inc_num v_age msvoff.
GET FILE = 'Directory\Path\sex_aslt.sav'.

The SORT CASES BY arranges the data in ascending order first by ori number then by incident number.  MATCH FILES combines variables from the data file Incident 1999.sav with the working data file sex_aslt.sav.  This is a one-to-many match.  NIBRS allows only one incident (also called administrative) record per incident.  There can be up to 99 victim records per incident.  The /TABLE subcommand on the MATCH command sets up SPSS to match the single incident record with all victims in the incident.

SORT CASES BY ori (A) inc_num (A).
  /TABLE='Directory\Path\Incident 1999.sav'
  /BY ori inc_num
  /DROP aggasl arfemale arr0509 arr1017 arr1524 arr65 arr_cnt arradult arrmale asl_arr att_comp
  bur bur_arr clr_arr clr_excp firearm inc_dy inc_loc inc_mo inc_yr indivl lar lar_arr msioff mur
  mur_arr mvt mvt_arr oasl_arr off1017 off1524 off65 off_cnt offadult offemale offmale
  ofns_cnt oth_asl rap rap_arr rob rob_arr vadult vage1017 vage1524 vage65 vfemale vic_cnt vic_inj
  vlt18 vmale.

RECODE simply assigns new numerical values to the variable INC_HR, which is then put into the new variable INC_HR2.  VALUE LABELS then assigns a descriptive label to each numerical value for the variable INC_HR2.

RECODE inc_hr
(6 = 1)  (7 = 2)  (8 = 3)  (9 = 4)  (10 = 5)  (11 = 6)  (12 = 7)  (13 = 8)  (14 = 9)  (15 = 10)  (16 = 11)
(17 = 12)  (18 = 13)  (19 = 14)  (20 = 15)  (21 = 16)  (22 = 17)   (23 = 18)  (1 = 19)  (2 = 20)  (3 = 21)
(4 = 22) (5 = 23)into inc_hr2.
1 '6 am'  2 '7 am'  3 '8 am'  4 '9 am'  5 '10 am'  6 '11 am'   7 'Noon'  8 '1 pm'  9 '2 pm'  10 '3 pm'  11 '4 pm'
12 '5 pm'  13 '6 pm'  14 '7 pm'  15 '8 pm'  16 '9 pm'  17 '10 pm'   18 '11 pm'  19 '1 am'
20 '2 am'  21 '3 am'  22 '4 am'  23 '5 am'. 

VARIABLE LABELS then assigns the label 'Time of Incident' to the variable inc_hr2.   COMPUTE creates a new variable agegrp and sets its value at zero.  The IF transformation creates four age groups.  VALUE LABELS assigns a descriptive label to each numerical value for the variable agegrp.

VARIABLE LABELS inc_hr2 'Time of Incident'.
COMPUTE agegrp = 0.
IF (v_age gt 0 and v_age lt 6)agegrp = 1.
IF (v_age ge 6 and v_age lt12)agegrp = 2.
IF (v_age ge12 and v_age lt 18)agegrp = 3.
IF (v_age ge18)agegrp = 4.
1 'Victims under age 6'  2 'Victims ages 1 through 11'  3 'Victims ages 12 through 17'  4 'Victims ages 18 and over'.

The USEALL defines a USE range beginning with the first and ending with the last observation in the series.  This COMPUTE illustrates the use of a filter to select only those incidents that had an incident hour and age group greater than zero.  The cases are then sorted by age group.  SPLIT FILE compares the two age groups (victims under 6 and victims 6 through 11).  LAYERED BY displays the age groups in the same table in the outermost column.

COMPUTE filter_$=(rptdate = ' ' and inc_hr gt 0 and agegrp gt 0).
VARIABLE LABEL filter_$ "rptdate = ' ' (FILTER)".
VALUE LABELS filter_$ 0 'Not Selected'  1 'Selected'.
FORMAT filter_$ (f1.0).
FILTER BY filter_$.
  LAYERED BY agegrp.

Producing the Output.  This output is defined as four simple bar graphs that displays the percentage of sexual assault incidents by hour.  Table 4 template.sct is used to control the look of the bar graphs.

  /BAR(SIMPLE)=PCT BY inc_hr2
  /TEMPLATE='Directory\Path\Table 4 template.sct'
  /TITLE 'Table 4: Temporal Distribution of Sexual Assault' 'Within Victim Age Categories'.

The resulting graphs look like this:

time_sexasslt1.jpg (33364 bytes)

time_sexasslt2.jpg (33632 bytes)

time_sexasslt3.jpg (38345 bytes)

time_sexasslt4.jpg (35752 bytes)