All your dates need to be actual SAS dates, not text strings.
And your data sets need to be in sorted order.
With those conditions in place, this would be one way to rearrange the pieces:
data want;
set table1 (rename=(DateofService=Date) in=in1)
table2 (rename=(Payment=Date) in=in2);
by Client Date;
if in1 then Action='Service';
else Action='Payment';
run;
Try it, see if you like what you get. (If you don't like it, you might have to design what you would like the solution to look like before programming can begin.)
... View more