Hello Onur,
I've added one suspect vehicle_id and prepared some code. This may give you a start...
data incidents;
input INCIDENT_ID 1-7 VEHICLE_ORDER_NO 9 VEHICLE_ID $ 11-27;
datalines;
4704002 1 JHMGD18707S205511
4704002 2 VF1LAOF0520635569
4704002 3 VF37ANFZWWP005871
4704053 1 VF32BKFWA9D002173
4704053 2 WF0HXXWPDH9C49160
4704053 2 VF1LAOF0520635569
run;
proc sql;
create table suspects as
select vehicle_id, count(distinct incident_id) as nr_incid
from incidents
group by 1;
create table incidents2 as
select incidents.*, suspects.nr_incid
from incidents, suspects
where incidents.vehicle_id = suspects.vehicle_id;
quit;
proc print data=incidents2;
run;
Hope this helps,
Cheers, Eric
... View more