You have a list of phone numbers. Lets assume they are in character format (each length $10), and that you don't care if the resulting de-duped phone numbers are in any particular order. Then (this is untested): data want (drop=_:); set have; array ph {*} $ phone1-phone4; length _list $60; do _P=1 to dim(ph); if ph{_P}=' ' then ; else if _list=' ' then _list=ph{_P}; else if index(cats('!',_list,'!'), cats('!',ph{_P},'!') )=0 then _list=catx('!',_list,ph{_P}); ph{_P}=' '; end; if _list ^=' ' then do _P=1 to countw(_list,'!'); ph{_P}=scan(_list,_P,'!'); end; run; What this does is scan the list of phone values and lists them, one at a time, in an exclamation-delimited character variable (_LIST). But it only adds a number if it is not already in _LIST (bounding by exclamation mark makes the task of checking for dupes much easier). Then it takes the values in _LIST, and puts them back into the original phone number variables, with dupes removed, and "left-justified". By the way, if the phone values are numeric, you'd only have to change the following (also untested). array ph {*} phone1-phone4; **drop the $ sign **; ph{_P}=input(scan(_list,_P,'!'),best10.); ** instead of ph{_P}=scan(_list,_P,'!') **;
... View more