BookmarkSubscribeRSS Feed
dincoo
SAS Employee

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

1 REPLY 1
EH
Obsidian | Level 7 EH
Obsidian | Level 7

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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 1 reply
  • 1027 views
  • 0 likes
  • 2 in conversation