Average Number of Personal Robberies Reported Per Day by Month (US 1999)

Brian A. Reeves, BJS

Download the SPSS syntax file

This table looks at the time of day robberies occur at various types of locations.  To create this table, time is grouped into 4-hour categories.   Robbery offenses are then selected.  Location is also grouped, and a cross-tabulation table is 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.

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.   First, the COMPUTE creates the variable pers_rob and sets the value to 0.  The IF transformation selects all incidents with at least one robbery and where at least one individual (person) was a victim.  SELECT IF chooses all cases in which the pers_rob variable had a value equal to 1.  The file is saved to a new file.  VALUE LABELS assigns the name of the month to the corresponding numerical value in the variable inc_mo.

GET FILE='Directory\Path\incident 1999.sav'.
COMPUTE pers_rob = 0.
IF (rob ge 1 and indivl ge 1)pers_rob = 1.
SELECT IF (pers_rob = 1).
SAVE OUTFILE='Directory\Path\Personal Robberies 1999.sav'.

VALUE LABELS inc_mo 1 'January'  2 'February'  3 'March'  4 'April'   5 'May'  6 'June'
  7 'July'  8 'August'  9 'September'  10 'October'  11 'November'  12 'December'.

Cases are first sorted in ascending order (A) by inc_mo and inc_dy.  The AGGREGATE restructures the data and changes the unit of analysis to incident month.   The data are saved in a new file.

SORT CASES BY inc_mo (A) inc_dy.
AGGREGATE
  /OUTFILE = 'Directory\Path\inc_mo agg.sav'
  /BREAK=inc_mo
  /inc_dy = LAST(inc_dy)
  /rob=SUM(rob).
GET FILE = 'Directory\Path\inc_mo agg.sav'.

COMPUTE creates the new variable avg_dy that is equal to the number of robberies (rob) divided by the incident day (inc_dy).  The FORMATS command indicates the number of places beyond the decimal that will be displayed.

COMPUTE avg_dy=rob/inc_dy.
FORMATS avg_dy (f8.0).

Producing the Output. To produce the data necessary to replicate the table, two tables must be created. For the first table, the output is defined as a table that displays the average number of personal robberies reported per day by month.

TABLES
  /FORMAT BLANK MISSING ('.')
  /OBSERVATION=avg_dy
  /GBASE=CASES
  /TABLE=inc_mo BY avg_dy
  /STATISTICS mean(avg_dy 'Daily Average')
  /TITLE 'Average Number of Personal Robberies' 'Reported per Day by Month (US 1999)'.

For the second table, only robberies with an actual date and time are selected for analysis; incidents coded with a "report" date are excluded.  This example also assumes that inc_hr is reported correctly; incidents coded as occurring at midnight are included.

GET FILE='Directory\Path\Personal Robberies 1999.sav'.
DO IF (rptdate = ' ').
RECODE inc_hr (0 thru 3 = 1)(4 thru 7 = 2)(8 thru 11 = 3)(12 thru 15 = 4)(16 thru 19 = 5)
  (20 thru 23 = 6)INTO time.
END IF.
VALUE LABELS time 1 'Mid - 3:59 am'  2 '4 - 7:59 am'  3 '8 - 11:59 am'  4 'Noon - 3:59 pm'
  5 '4 - 7:59 pm'  6 '8 - 11:59 pm'.
FREQ time.

When using the 1999 NIBRS data, the resulting tables look like this:

time_personal_robberies.jpg (44817 bytes)