Incidents on School Property by Hour

Division of Criminal Justice Services, Criminal Justice Statistical Analysis Center, Department of Military Affairs and Public Safety, State of West Virginia

Download SPSS syntax
Download SPSS Table Template

This example looks at the time of day incidents occur on school property.   To deal with the issue of misreporting, the midnight hour was removed from the graph.  To create the graph, offenses occurring at the location code of school/college were selected.  A simple bar graph of the frequency of the incident hour was then produced.  Labels outlining the school day were added.  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 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.   VALUE LABELS assigns a descriptive label to each numerical value of the variable inc_loc.  SELECT IF selects only those incidents that occurred at a school or college.  These incidents are saved to a new file.  The KEEP subcommand on the SAVE command limits the new file to only those variables necessary for the analysis.

GET FILE='Directory\Path\incident 1999.sav'.
VALUE LABELS inc_loc 1 'Air/Bus/Train Terminal'  2 'Bank/Savings & Loan'  3 'Bar/Night Club' 
  4 'Church/Synagogue/Temple'  5 'Commercial/Office Building'  6 'Construction Site'  7 'Convenience Store'
  8 'Department/Discount Store'  9 'Drug Store/Doctor's Office/Hospital'   10 'Field/Woods'
  11 'Government/Public Building'  12 'Grocery/Supermarket'  13 'Highway/Road/Alley'  14 'Hotel/Motel'
  15 'Jail/Prison'  16 'Lake/Waterway'  17 'Liquor Store'  18 'Parking Garage'  19 'Rental Storage Facility'
  20 'Residence/Home'  21 'Restaurant'  22 'School/College'  23 'Service/Gas Station'  24 'Specialty Store'
  25 'Other/Unknown'.

SELECT IF inc_loc = 22.
SAVE OUTFILE = 'Directory\Path\Table3 data.sav'/keep = inc_hr rptdate inc_loc.

The VALUE LABELS assigns a descriptive label to the numerical values for the variable inc_hr.

GET FILE = 'Directory\Path\Table3 data.sav'.
VALUE LABELS inc_hr 1 '1 am'  2 '2'  3 '3'  4 '4 am'  5 '5'  6 '6 am'  7 '7'  8 '8 am'  9 '9'  10 '10 am'
  11 '11'  12 'Noon'  13 '1 pm'  14 '2'  15 '3 pm'  16 '4'   17 '5 pm'  18 '6'  19 '7 pm'  20 '8'  21 '9 pm'
  22 '10'  23 '11 pm'.

The FILTER is used to limit the cases for the analysis to only those cases with a value greater than zero.

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

Producing the Output. This output is defined as a simple line graph that displays the percent of incidents on school property by hour.

  /TEMPLATE='Directory\Path\Table3 template.sct'
  /TITLE 'Table 3: Incidents on School Property by Hour'
  /FOOTNOTE='Source: US NIBRS Data 1999.' 'The midnight hour was removed from the graph due to
    misreporting issues'.

Using 1999 NIBRS data, the resulting graph looks like this:

time_school.jpg (44021 bytes)