Fraud, AML and Security Intelligence

Prevent fraud, achieve compliance and preserve security.
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Rian0126
Obsidian | Level 7

Hi,

 

I'm doing a data step scenario to show telephone_uid (tel_number in data step code) with more than 1 unique full_name. 

Screenshot 2022-03-29 234340.jpg Here is my data step code:

Screenshot 2022-03-29 234620.jpg

I need an advice on how to correct my code to show only those tel_number with more than 1 full_name associated on it.

 

Thank you.

 

Regards,

Adrian

 

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

Below code should work but is untested because you didn't provide sample data in a usable format.

proc sort 
    data=&input_dataset(keep=tel_number full_name)
    out=intermediate
    nodupkey;
  by tel_number full_name;
run;

data &output_dataset;
  set intermediate;
  by tel_number;

  if first.tel_number then name_count=1;
  else name_count+1;

  if last.tel_number and name_count>1 then
    do;
      &message=catx(' ','Telephone : ',tel_number,'Suspicious.... to', name_count,'people...');
      ....
      output;
    end;
run;

For future questions please post your data and code as text and not as screenshots. Use icons

 Patrick_0-1648583285463.png

to do so.

 

Would you have been happy if I'd posted my reply as picture?

Patrick_1-1648583331312.png

 

 

 

View solution in original post

2 REPLIES 2
Patrick
Opal | Level 21

Below code should work but is untested because you didn't provide sample data in a usable format.

proc sort 
    data=&input_dataset(keep=tel_number full_name)
    out=intermediate
    nodupkey;
  by tel_number full_name;
run;

data &output_dataset;
  set intermediate;
  by tel_number;

  if first.tel_number then name_count=1;
  else name_count+1;

  if last.tel_number and name_count>1 then
    do;
      &message=catx(' ','Telephone : ',tel_number,'Suspicious.... to', name_count,'people...');
      ....
      output;
    end;
run;

For future questions please post your data and code as text and not as screenshots. Use icons

 Patrick_0-1648583285463.png

to do so.

 

Would you have been happy if I'd posted my reply as picture?

Patrick_1-1648583331312.png

 

 

 

Rian0126
Obsidian | Level 7

Thanks for the reminder @Patrick and thanks for the answer.

 

Regards,

Adrian

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Discussion stats
  • 2 replies
  • 4928 views
  • 1 like
  • 2 in conversation