|
|
|
Location of Robbery
South Carolina Department of Public Safety
Download SPSS syntax
Download Table Template file
This example looks at robbery locations. This chart was created by
grouping choosing the most frequent locations of robberies, combining commercial locations
into one category. All robbery offenses were then selected and a cross-tabulation
table was 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 example requires that you download a template file before
running the syntax.
| 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
all robbery incidents and saves them into a new file, Robbery 1999.sav. |
GET FILE='Directory\Path\Incident 1999.sav'.
SELECT IF (rob ge 1).
SAVE OUTFILE='Directory\Path\Robbery 1999.sav'.
| The RECODE groups the values for the variable
incident location into four numeric categories and names the new variable 'location'.
VALUE LABELS assigns a descriptive label to each numerical value for the variable
'location'. |
GET FILE='Directory\Path\Robbery 1999.sav'.
RECODE inc_loc
(13,18 = 1)(2,3,5,8,9,12,14,17,21 = 2)(20 = 3)(7,23,24 = 4)(else = 5)INTO location.
VARIABLE LABELS location 'Location'.
VALUE LABELS location
1 'Road/Hwy/Parking Garage' 2 'Commercial' 3 'Residences' 4
'Service/Conv Store' 5 'Other'.
| Creating the Output. This output is defined as a simple bar
graph that displays the percentage of robberies by location. The TEMPORARY VARIABLE
LABELS nullifies the variable label for the graph and for variable location. We also
use a previously defined template for formatting the chart. |
TEMPORARY.
VARIABLE LABELS location ' '.
GRAPH
/BAR(SIMPLE)=PCT BY location
/MISSING=REPORT
/TEMPLATE='Directory\Path\Table8 template.sct'
/TITLE='Robberies by Location'.
| The resulting bar graph looks like this: |

|