Dear SAS community,
I am trying to compare two columns which are almost same as shown below. If you look at the data carefully the sender is same as receiver (except that some of the rows have middle name etc). I have to code in a way where I can get the last record where the sender and receiver names don't match at all. This is the sample data of real time data. Please help me to find a solution. I tried using like operator and contains operator but of no use.
Thanks in advance
DATA have ;
INPUT sender $13. receiver$33.;
CARDS;
DON A ABROGS FOR FURTHER CREDIT: DON A ABROGS
ANTHONY BOGGS INFAVOR OF ANTHONY L BOGGS
TIM D BRUNS TIMOTHY BRUNS
KEN V PAYE KENNETH V PAYE
ERICA PARIS ERICA N PARIS
JEFF WOOD JEFFORY WOOD
NICK PATEL CREDIT TO: 345678 (NICK PATEL)
JOEL NELSON TAMMY WOODWARDS
;
RUN;
I tried the following code and didn't get what I wanted. I need to see the last record (joel nelson and tammy woodwards) record as a result
proc sql;
create table want as
select *
from have
where compress(receiver) like '%'||compress(sender)||'%'
; quit;
DATA have ;
INPUT sender $13. receiver$33.;
CARDS;
DON A ABROGS FOR FURTHER CREDIT: DON A ABROGS
ANTHONY BOGGS INFAVOR OF ANTHONY L BOGGS
TIM D BRUNS TIMOTHY BRUNS
KEN V PAYE KENNETH V PAYE
ERICA PARIS ERICA N PARIS
JEFF WOOD JEFFORY WOOD
NICK PATEL CREDIT TO: 345678 (NICK PATEL)
JOEL NELSON TAMMY WOODWARDS
;
RUN;
sorry for unformatted data posting previously
Thanks Ksharp !! I will give it a try.
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!
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.
Ready to level-up your skills? Choose your own adventure.