SAVING INDIVIDUAL DATA SEGMENTS IN SPSS

Click here to download SPSS code

The following code breaks the aggregated flat file into segments (offense, property, victim, offender, and arrestee).   Each segment is saved separately. When using this code, be sure to insert the path and the file name of the data to be used, as well as the directory and filename for each segment to be saved. If you need any assistance in 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 tape from the FBI in ASCII format;
  2. The data file request was filtered to include only incident reports for incident year 1996;
  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);
  4. The anticipated data analysis will include only the Offense Group "A" data segments. In addition to summary level counts to describe incidents, this example identified juvenile victims and offenders, older victims and offenders, and multiple offender incidents; and
  5. The data file was read as described in "Reading A Multi-Level Data File Into SPSS"and an aggregated flat file was created as described in "Creating An Incident-Level Aggregated Flat File In SPSS."

GET FILE='Directory:\Path\Incident-level file.sav'.

This series of DO IF / ELSE IF and SAVE commands breaks out each NIBRS Offense Group "A" data segment from the aggregated flat file created in Creating An Incident-Level Aggregated Flat File In SPSS and saves each segment as a separate file.

DO IF (ibr_rec = '01').
XSAVE OUTFILE = 'Directory:\Path\Admin segment.sav'/keep = ibr_rec to incoff10.
ELSE IF (ibr_rec = '02').
XSAVE OUTFILE = 'Directory:\Path\Offense segment.sav'/keep = ibr_rec to inc_date
   att_comp to bias
   off_code offense.
ELSE IF (ibr_rec = '03').
XSAVE OUTFILE = 'Directory:\Path\Property segment.sav'/keep = ibr_rec to inc_date
   losstype to p_off10.
ELSE IF (ibr_rec = '04').
XSAVE OUTFILE = 'Directory:\Path\Victime segment.sav'/keep = ibr_rec to inc_date
   vic_num to ovr10
   voff1 to voff10
   msvoff v_age.
ELSE IF (ibr_rec = '05').
XSAVE OUTFILE = 'Directory:\Path\Offender segment.sav'/keep = ibr_rec to inc_date
   ofnseq to off_race.
ELSE IF (ibr_rec = '06').
XSAVE OUTFILE = 'Directory:\Path\Arrestee segment.sav'/keep = ibr_rec to inc_date
   arrseq to arr_clr
   arroff.
ELSE IF (ibr_rec = '07').
XSAVE OUTFILE = 'Directory:\Path\ArresteegrpB segment.sav'/keep = ibr_rec to inc_date
   arrseq to arr_disp.
END IF.
EXECUTE.