Research Question 2: For violent person crimes, when is the victimization of a person aged 65 or older in a residential setting most likely to occur?
The following code creates the variables necessary to answer the research question and creates a table. When using this code, be sure to insert the path and the file name of the data file to be used (which occurs numerous times in this example). The final data file is not saved, so if you want to save the variables that were created, be sure and save the file before exiting. If you need any assistance working with the syntax provided, please contact us.
The assumptions for the following example of code are:
|Defining the Variables
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. Additional variables were created in the first older adult example.
The following filter selects only incidents with victims who are age 65 or older and only those violent incidents that occurred at a residence or home. In the incident-level flat file, the date of the incident is defined in three variables INC_DY, INC_MO, and INC_YR. These variables are used to first define a date (DATE.DMY) and then compute the corresponding day of week. Then, the time of the incident (INC_HR) is RECODEd into one of the four quarters in a 24-hour time period. Like in the previous example, variables for offense location and age group are also created.
GET FILE = 'Directory:\Path\Incident-level flat file.sav'.
RECODE inc_loc (20 = 1)(else = 2)into locgroup.
VALUE LABELS locgroup 1 'Home/Residence'
2 'Other Location'.
RECODE vage65 (0 = 2)(1 thru hi = 1)into age65grp.
VALUE LABELS age65grp 1 'Age 65 or Older'
2 'Age 64 or Younger'.
COMPUTE filter_$=(age65grp = 1 & locgroup = 1 & msoffgp = 1).
VARIABLE LABEL filter_$ 'age65grp = 1 & locgroup = 1 & msoffgp = 1(FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMAT filter_$ (f1.0).
FILTER by filter_$.
COMPUTE DayofWk =
FORMATS dayofwk (WKDAY3).
|Only the incidents with an actual date and time are selected for analysis; incidents coded with a "report" date are excluded. This example also assumes that the INC_HR is reported correctly; incidents at zero hours, representing the midnight hour, are included. (See the Data Quality example on using the variable incident hour for more information.) Twenty-four hour periods are divided into quarters for analysis.|
DO IF (rptdate = ' ').
RECODE inc_hr (0 thru 5 = 1)
(6 thru 11 = 2)
(12 thru 17 = 3)
(18 thru 23 = 4)into qutrday.
VALUE LABELS qutrday 1 'Midnight to 5 a.m.'
2 '6 a.m. to 11a.m.'
3 'Noon to 5 p.m.'
4 '6 p.m. to 11 p.m.'.
|Producing the Output
The output is defined as a table that displays the time of day quarters by the days of the week. Totals are shown for both columns and rows. Percentages are calculated for both day of week and time period.
* General Tables.
VARIABLE LABELS qutrday 'Time of Day' dayofwk 'Day of Week' .
/format blank missing('.')
/ftotal= $t000002 "Total" $t000001 "Total"
/table=qutrday + $t000002 BY dayofwk + $t000001
cpct( dayofwk( PCT5.1 ) '')
/TITLE 'Time of Day and Day of Week for'+' Offenses Committed Against Older Adults in Residential Settings'.
|The output produced by these commands is a table.
The table below shows that the peak days of the week of person offenses committed against adults aged 65 or older in residential settings are Saturday (15.9%), Thursday (15.6%), and Monday (15%). The peak time period is 6 p.m. to 11 p.m. (39.4%), which is followed closely by the time period of noon to 5 p.m. (31.6%).