spacer spacer spacer
JRSA's IBR Resource Center
Return to Main Page
Background and Status of Incident-Based Reporting and NIBRS
State Profiles
Using Incident-Based and NIBRS Data
References and Related Sites
Available Syntax and Sample Data Files
line divider
IBRRC Fact Sheet
Contribute Information
Site Map
Justice Research and Statistics Association (JRSA) Home
 
Notice of Federal Funding and Federal Disclaimer
 

READING A MULTILEVEL DATA FILE INTO SPSS

Click here to download SPSS code

The following code converts FBI NIBRS data from ASCII format to a large SPSS flat file.  When using this code, be sure to insert the path and file name of the data file to be used below, 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 NIBRS data file was obtained on tapes from the FBI in ASCII format;
  2. The data file request was filtered to include only incident reports with an incident year of 1996; and
  3. The NIBRS data segments that comprise a single incident report can be linked by a combination of the ORI data field plus the incident number data field (incident numbers are encrypted).

FILE TYPE MIXED FILE tells SPSS that the file to be read has multiple records per (incident) case and that each record has a variable length.  This allows SPSS to define a unique structure for each record.  The RECORD command directly following identifies the data columns from which the segments are identified.  The RECORD TYPE command in combination with the DATA LIST command creates the seven data segments.

 

FILE TYPE MIXED FILE = 'Directory:\Path\Filename'
RECORD = ibr_rec 1-2 (a) .

RECORD TYPE '01' in combination with the DATA LIST defines the NIBRS Offense Group "A" administrative segment as the first record type to be read. Variables are created for incident year, month, and day because the tape only contains the incident date in YYYYMMDD format. All other variables are on the FBI NIBRS tape received.

RECORD TYPE '01'.
DATA LIST /
st_code 3-4
ori 5-13(a)
inc_num 14-25(a)
inc_date 26-33
inc_yr 26-29
inc_mo 30-31
inc_dy 32-33
inc_hr 35-36
rptdate 34 (a)
tot_oseg 37-38
tot_vseg 39-41
tot_dseg 42-43
tot_aseg 44-45
city_sub 46-49(a)
excp_clr 50 (a)
exclr_yr 51-54
exclr_mo 55-56
exclr_dy 57-58
incoff1 to incoff10 (t59,10(a3)).

The variable definition for incoff1 to incoff10, above, defines the
incident offense(s) as beginning in column 59, having up to 10 valid
occurrences, and being alphanumeric in type with a field length of 3
columns. This shortcut using fortran-like programming is used for all
variables that have repeating occurrences.

 

RECORD TYPE '02' in combination with DATA LIST defines the NIBRS
Offense Group "A" offense segment as the second record type to be
read.  The FBI NIBRS ASCII data file includes the ORI number, incident
number, incident date, year, month, and day data elements in each of the
data segments. Variables are created for incident year, month, and day
because the tape only contains the incident date in YYYYMMDD
format. These variables are defined for each segment.


RECORD TYPE '02'.
DATA LIST /
st_code 3-4
ori 5-13(a)
inc_num 14-25(a)
inc_date 26-33
inc_yr 26-29
inc_mo 30-31
inc_dy 32-33
off_code 34-36 (a)
att_comp 37 (a)
suspuse1 to suspuse3 38-40(a)
off_loc 41-42 (a)
prem_ent 43-44
meth_ent 45 (a)
crimact1 to crimact3 46-48(a)
weapon1 49-50 (a)
weapon2 52-53 (a)
weapon3 55-56 (a)
autowpn1 51 (a)
autowpn2 54 (a)
autowpn3 57 (a)
bias 58-59 (a).

The variable definition for incoff1 to incoff10, above, defines the incident offense(s) as beginning in column 59, having up to 10 valid occurrences, and being alphanumeric in type with a field length of 3 columns. This shortcut using fortran-like programming is used for all variables that have repeating occurrences.

RECORD TYPE '02' in combination with data list defines the NIBRS Offense Group "A" offense segment as the second record type to be read.

The FBI NIBRS ASCII data file includes the ORI number, incident number, incident date, year, month, and day data elements in each of the data segments. Variables are created for incident year, month, and day because the tape only contains the incident date in YYYYMMDD format. These variables are defined for each segment.

Record type '02'.
data list /
st_code 3-4
ori 5-13(a)
inc_num 14-25(a)
inc_date 26-33
inc_yr 26-29
inc_mo 30-31
inc_dy 32-33
off_code 34-36 (a)
att_comp 37 (a)
suspuse1 to suspuse3 38-40(a)
off_loc 41-42 (a)
prem_ent 43-44
meth_ent 45 (a)
crimact1 to crimact3 46-48(a)
weapon1 49-50 (a)
weapon2 52-53 (a)
weapon3 55-56 (a)
autowpn1 51 (a)
autowpn2 54 (a)
autowpn3 57 (a)
bias 58-59 (a).

RECORD TYPE '03' in combination with DATA LIST defines the NIBRS Offense Group "A" property segment as the third record type to be read.

RECORD TYPE '03'.
DATA LIST /
st_code 3-4
ori 5-13(a)
inc_num 14-25(a)
inc_date 26-33
inc_yr 26-29
inc_mo 30-31
inc_dy 32-33
losstype 34(a)
p_desc 35-36(a)
p_valu 37-45
p_date 46-53
MVT_num 54-55
mvt_reco 56-57
drugtyp1 to drugtyp3 (t58,3(a1,14x))
wholqua1 to wholqua3 (t59,3(f9.0,6x))
fracqua1 to fracqua3 (t68,3(f3.0,12x))
typmeas1 to typmeas3 (t71,3(a2,13x))
p_off1 to p_off10 (t103,10(a3)).

RECORD TYPE '04' in combination with DATA LIST defines the NIBRS Offense Group "A" victim segment as the fourth record type to be read.

RECORD TYPE '04'.
DATA LIST /
st_code 3-4
ori 5-13(a)
inc_num 14-25(a) inc_date 26-33
inc_yr 26-29
inc_mo 30-31
inc_dy 32-33
vic_num 34-36
v_off1 to v_off10 37-66 (a)
v_type 67 (a)
vic_age 68-69 (a)
vic_sex 70 (a)
v_race 71 (a)
v_ethnic 72 (a)
v_resid 73 (a)
vcircum1 74-75 (a)
vcircum2 76-77 (a)
vjusthom 78 (a)
v_inj1 to v_inj5 79-83 (a)
ofnseq1 to ofnseq10 (t84,10(f2.0,2x))
ovr1 to ovr10 (t86,10(a2,2x)).

RECORD TYPE '05' in combination with DATA LIST defines the NIBRS Offense Group "A" offender segment as the fifth record type to be read.

RECORD TYPE '05'.
DATA LIST /
st_code 3-4
ori 5-13(a)
inc_num 14-25(a)
inc_date 26-33
inc_yr 26-29
inc_mo 30-31
inc_dy 32-33
ofnseq 34-35
off_age 36-37
off_sex 38 (a)
off_race 39 (a).

RECORD TYPE '06' in combination with DATA LIST defines the NIBRS Offense Group "A" arrestee segment as the sixth record type to be read.

RECORD TYPE '06'.
DATA LIST /
st_code 3-4
ori 5-13(a)
inc_num 14-25(a)
inc_date 26-33
inc_yr 26-29
inc_mo 30-31
inc_dy 32-33
arrseq 34-35
atr 36-47 (a)
arr_yr 48-51
arr_mo 52-53
arr_dy 54-55
arr_type 56 (a)
msg 57 (a)
arr_off 58-60 (a)
arr_wpn1 61-62 (a)
autowpn1 63 (a)
arr_wpn2 64-65 (a)
autowpn2 66(a)
arr_age 67-68
arr_sex 69 (a)
arr_race 70 (a)
arr_ethn 71(a)
arr_res 72 (a)
arr_disp 73 (a)
arr_clr 74 (a)
arroff1 to arroff10 (t75,10(a3)).

RECORD TYPE '07' in combination with DATA LIST defines the NIBRS Offense Group "B" arrestee segment as the seventh record type to be read.   END FILE TYPE, on the last line, indicates RECORD TYPE '07' is the last segment to be read.

RECORD TYPE '07'.
DATA LIST /
st_code 3-4
ori 5-13(a)
inc_num 14-25(a)
arr_date 26-33
arr_yr 26-29
arr_mo 30-31
arr_dy 32-33
arrseq 34-35
city_sub 36-39(a)
arr_type 40 (a)
arr_off 41-43 (a)
arr_wpn1 44-45 (a)
autowpn1 46 (a)
arr_wpn2 47-48 (a)
autowpn2 49(a)
arr_age 50-51
arr_sex 52 (a)
arr_race 53 (a)
arr_ethn 54(a)
arr_res 55(a)
arr_disp 56 (a).
END FILE TYPE.

This SAVE command saves the entire data file in an SPSS format.

SAVE OUTFILE = 'Directory:\Path\Filename.sav'.