BookmarkSubscribeRSS Feed
mionnh
Calcite | Level 5


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?

2 REPLIES 2
LinusH
Tourmaline | Level 20

Is this for training?

Also, it's hard to give any solid advice without seeing any data.

Data never sleeps
Sajid01
Meteorite | Level 14

Hello @mionnh 
These are fairly straightforward questions.
Please try and let us know if you have any error.
make sure data is included in the post as sas datastep and the log.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1028 views
  • 1 like
  • 3 in conversation