Hello helpers:)
I am trying to concatenate client's contact into one column and do not want it appears multiple times if the same number registered under home/work/mobile.
Client_Contact=catx(',',Home_Phone,Work_Phone,Mobile_Phone);
I googled and only found below solution. Just wondered if there is any other better way to achieve it?
Thanks in advance 🙂
https://stackoverflow.com/questions/42616892/sas-remove-duplicated-words-in-a-string
You could reset the values before concatenating?
H=ifc( Home_Phone = Work_Phone , ' ', Home_Phone );
M=ifc( Home_Phone = Mobile_Phone , ' ', Mobile_Phone);
W=ifc( Work_Phone = Mobile_Phone , ' ', Work_Phone );
Client_Contact=catx(',', H, M, W);
Otherwise, if you had many values in the list, using call sortx allows you to only compare to the next value in the list rather than compare to the rest of the whole list.
You could reset the values before concatenating?
H=ifc( Home_Phone = Work_Phone , ' ', Home_Phone );
M=ifc( Home_Phone = Mobile_Phone , ' ', Mobile_Phone);
W=ifc( Work_Phone = Mobile_Phone , ' ', Work_Phone );
Client_Contact=catx(',', H, M, W);
Otherwise, if you had many values in the list, using call sortx allows you to only compare to the next value in the list rather than compare to the rest of the whole list.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.