*Prepare the files for matching by sorting on the match variables GET FILE = 'Directory:\Path\Admin segment.sav'. SORT CASES BY ori inc_num. SAVE outfile = 'Directory:\Path\Admin segment.sav'. GET FILE = 'Directory:\Path\Offense segment.sav'. SORT CASES BY ori inc_num. *Match the files, selecting only the necessary variables from the Admin Segment MATCH FILES /FILE=* /FILE='Directory:\Path\Admin segment.sav' /RENAME (city_sub exclr_dy exclr_mo exclr_yr excp_clr ibr_rec inc_date incoff1 incoff10 incoff2 incoff3 incoff4 incoff5 incoff6 incoff7 incoff8 incoff9 rptdate st_code tot_aseg tot_dseg tot_oseg tot_vseg = d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 d16 d17 d18 d19 d20 d21 d22) /BY ori inc_num /DROP= d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15 d16 d17 d18 d19 d20 d21 d22. EXECUTE. *Recode offense codes into Crimes Against Persons, Property, and Society and provide labels recode off_code ('200' = 2) ('13A' = 1) ('13B' = 1) ('13C' = 1) ('510' = 2) ('220' = 2) ('250' = 2) ('290' = 2) ('35A' = 3) ('35B' = 3) ('270' = 2) ('210' = 2) ('26A' = 2) ('26B' = 2) ('26C' = 2) ('26D' = 2) ('26E' = 2) ('39A' = 3) ('39B' = 3) ('39C' = 3) ('39D' = 3) ('09A' = 1) ('09B' = 1) ('09C' = 1) ('100' = 1) ('23A' = 2) ('23B' = 2) ('23C' = 2) ('23D' = 2) ('23E' = 2) ('23F' = 2) ('23G' = 2) ('23H' = 2) ('240' = 2) ('370' = 3) ('40A' = 3) ('40B' = 3) ('120' = 2) ('11A' = 1) ('11B' = 1) ('11C' = 1) ('11D' = 1) ('36A' = 1) ('36B' = 1) ('280' = 2) ('520' = 3) into cri_typ. VARIABLE LABELS cri_typ 'Crime Type Categorization'. value labels cri_typ 1 'Crimes Against Persons' 2 'Crimes Against Property' 3 'Crimes Against Society'. *Recode time of offense into categories RECODE inc_hr (7 thru 14=1) (15 thru 22=2) (23 thru 24=3) (0 thru 6=3) INTO time_cat. VARIABLE LABELS time_cat 'Time Category'. value labels time_cat 1 '7 am - 3 pm' 2 '3 pm - 11 pm' 3 '11 pm - 7 am'. EXECUTE . *Now create the bar graphs by aggregating the file by the categories and matching the aggregated files to the originial data set COMPUTE DUMMY=1. EXE. SORT CASES BY cri_typ TIME_CAT. AGGREGATE /OUTFILE='Directory:\Path\AGGR1.SAV' /BREAK= cri_typ TIME_CAT /numer= N(dummy). MATCH FILES FILE=* /TABLE='Directory:\Path\AGGR1.SAV' /BY cri_typ TIME_CAT. EXECUTE. SORT CASES BY CRI_TYP. AGGREGATE /OUTFILE='Directory:\Path\AGGR2.SAV' /BREAK=CRI_TYP /denom = N(dummy). MATCH FILES FILE=* /TABLE='Directory:\Path\AGGR2.SAV' /BY CRI_TYP. EXECUTE. COMPUTE pct=(numer/denom)*100. FORMATS pct (f2). EXECUTE. IGRAPH /VIEWNAME='Bar Chart' /X1 = VAR(cri_typ) TYPE = CATEGORICAL /Y = VAR(pct) TYPE = SCALE /COLOR = VAR(time_cat) TYPE = CATEGORICAL CLUSTER /COORDINATE = VERTICAL /X1LENGTH=3.0 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE' /CATORDER VAR(cri_typ) (ASCENDING VALUES OMITEMPTY) /CATORDER VAR(time_cat) (ASCENDING VALUES OMITEMPTY) /BAR(MEAN) KEY=ON LABEL INSIDE VAL SHAPE = RECTANGLE BASELINE = AUTO. EXE.