Hi everyone,
We have a rule that helps to find auto insurarance fraud and I am trying to code it.
The rule is: If the same vehicle_id's appear more than one incident.
The sample data is attached.
At the example there are two claims. First of them consists of 3 vehicles, second of them consists of 2 vehicles.
Thank you very much,
Onur
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
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!
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.