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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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