Use hash objects:
/* the dataset you have */
data have;
input ID :$6. Date :mmddyy10.;
format date yymmdd10.;
datalines;
253645 01/23/2004
234654 02/05/2001
243657 03/06/1999
243657 05/06/2003
326789 09/03/2009
983211 04/03/2007
983211 08/10/2002
;
/* initialize a dataset which keeps the anonymized IDs */
data anonymize;
length id id_anon $6;
stop;
run;
/* anonymize, and keep a record */
data want;
set have end=done;
if _n_ = 1
then do;
length id_anon $6;
declare hash a (dataset:"anonymize");
a.definekey("id");
a.definedata("id","id_anon");
a.definedone();
declare hash b (dataset:"anonymize");
b.definekey("id_anon");
b.definedone();
end;
if a.find() = 0
then id = id_anon;
else do;
id_anon = put(rand("integer",100000,999999),6.);
do while (b.check() = 0);
id_anon = put(rand("integer",100000,999999),6.);
end;
rc = a.add();
rc = b.add();
id = id_anon;
end;
if done then rc = a.output(dataset:"anonymize");
drop id_anon rc;
run;
/* repeat with expanded data */
data have_new;
input ID :$6. Date :mmddyy10.;
format date yymmdd10.;
datalines;
253645 01/23/2004
234654 02/05/2001
243657 03/06/1999
243657 05/06/2003
326789 09/03/2009
983211 04/03/2007
983211 08/10/2002
123456 07/27/2022
;
data want_new;
set have_new end=done;
if _n_ = 1
then do;
length id_anon $6;
declare hash a (dataset:"anonymize");
a.definekey("id");
a.definedata("id","id_anon");
a.definedone();
declare hash b (dataset:"anonymize");
b.definekey("id_anon");
b.definedone();
end;
if a.find() = 0
then id = id_anon;
else do;
id_anon = put(rand("integer",100000,999999),6.);
do while (b.check() = 0);
id_anon = put(rand("integer",100000,999999),6.);
end;
rc = a.add();
rc = b.add();
id = id_anon;
end;
if done then rc = a.output(dataset:"anonymize");
drop id_anon rc;
run;
Look at the resulting datasets.
From there it should be easy to expand the logic for date, depending on if id and date form a pair or if id and date need to be anonymized separately.