CALL SORTC will sort a list of character variables _on that row_ alphabetically. So in this case this is quite useful.
If you don't care about preserving client1/client2, then you can just do it directly to the variables and then proceed with your CAT strategy (I like CATX with a delimiter because it prevents from issues like
id1 = ABC
id2 = DEF
vs
id1 = AB
id2 = CDEF
those cats'ed together are identical, but aren't actually.
Here's an example preserving client1/client2 order.
data work.have_actual;
infile cards expandtabs truncover;
input manager client1 $ client2 $;
cards;
6363 123A 45C6C
6363 45C6C 123A
;
run;
data work.temporary;
set have_actual;
array client[2];
array cl_temp[2] $ _temporary_;
do _i = 1 to dim(cl_temp);
cl_temp[_i] = client[_i];
end;
call sortc(of cl_temp[*]);
client_unique = catx('|',of cl_temp[*]);
run;
proc sort nodupkey data=work.temporary out=want;
by client_unique;
run;
And as Astounding notes indirectly: `>` (greater than) is perfectly fine to use for character variables. You could just as easily do what you did above, effectively, just as easily with character variables as numeric - with the same possible pitfalls, of course. `>` compares the ascii codepage value (or whatever codepage you are using), so `Z` > `A`, lowercase letters are greater than uppercase letters, all letters are greater than all numeric digits, and the various other symbols are all over the place (but consistently for any given symbol).
... View more