proc import datafile='C:\Users\n01427744\My Files\OneDrive\Files\SAS\ksi.csv'
out = work.ksi
dbms = csv;
run;
proc contents data=ksi;
run;
proc sort data=ksi
out = work.KSI_sortbyYearAccnum;
by Year Accnum;
run;
data AGGKSI;
set work.ksi_sortbyyearaccnum(Keep= Accnum Year Time Street1 Street2 offset road_class District wardnum Division
LATITUDE LONGITUDE LOCCOORD ACCLOC TRAFFCTL VISIBILITY LIGHT RDSFCOND ACCLASS IMPACTYPE
PEDESTRIAN CYCLIST AUTOMOBILE MOTORCYCLE TRUCK TRSN_CITY_VEH EMERG_VEH
PASSENGER SPEEDING AG_DRIV REDLIGHT ALCOHOL DISABILITY Neighbourhood);
by year accnum;
if last.accnum;
run;
proc print data=aggksi;
run;
Q1: Aggregate KSI data by ACCNUM, so that each observation is a unique KSI event.
a) How many KSI incidents occurred in the city of Toronto from 2006-2019?
b) Which is the most incidents district, neighborhood, and location?
c) What about the road and weather condition for most KSI incidents?
d) How many KSI incidents involving speeding were fatal ?
Q2: Transform the aggregated KSI data by Geographic Coordinates (Latitude and Longitude), each observation should be a unique location, so that the KSI number in each unique location can be calculated. What are the top five locations with most KSI incidents in Toronto?