Search code examples
sqlsasproc-sqlenterprise-guide

Changing a datetime by -1 if included in a list until it is not included in the list anymore


I have a date I want to change by -1 until it is not included in my list of datetimes.

Date i want to change:

REPORTING_Bank_DTTM
30APR2022:00:00:00

So in this case it would turn into 29APR2022:00:00:00

I have assigned the datetime to the following macro variable: &REPORTING_Bank_DTTM

The list of datetimes is called "BANKLUKKEDAGE" and is in the end of the post.

I have tried doing this:

data BANKLUKKEDAGE;
x=&REPORTING_Bank_DTTM; 
DO WHILE (&REPORTING_Bank_DTTM = Ignore_days);
    OUTPUT;
    x-1;
end;
%LET &REPORTING_Bank_DTTM_Final = x;
run;

But I a lot of errors here my guess i because the loop says "=" instead of "contains" but I haven't been able to find a contains function.

Ignore_days
14APR22:00:00:00
15APR22:00:00:00
18APR22:00:00:00
13MAY22:00:00:00
26MAY22:00:00:00
27MAY22:00:00:00
06JUN22:00:00:00
26DEC22:00:00:00
06APR22:00:00:00
07APR22:00:00:00
10APR22:00:00:00
05MAY22:00:00:00
18MAY22:00:00:00
19MAY22:00:00:00
29MAY22:00:00:00
05JUN22:00:00:00
25DEC22:00:00:00
26DEC22:00:00:00
01JAN22:00:00:00
02JAN22:00:00:00
08JAN22:00:00:00
09JAN22:00:00:00
15JAN22:00:00:00
16JAN22:00:00:00
22JAN22:00:00:00
23JAN22:00:00:00
29JAN22:00:00:00
30JAN22:00:00:00
05FEB22:00:00:00
06FEB22:00:00:00
12FEB22:00:00:00
13FEB22:00:00:00
19FEB22:00:00:00
20FEB22:00:00:00
26FEB22:00:00:00
27FEB22:00:00:00
05MAR22:00:00:00
06MAR22:00:00:00
12MAR22:00:00:00
13MAR22:00:00:00
19MAR22:00:00:00
20MAR22:00:00:00
26MAR22:00:00:00
27MAR22:00:00:00
02APR22:00:00:00
03APR22:00:00:00
09APR22:00:00:00
10APR22:00:00:00
16APR22:00:00:00
17APR22:00:00:00
23APR22:00:00:00
24APR22:00:00:00
30APR22:00:00:00
01MAY22:00:00:00
07MAY22:00:00:00
08MAY22:00:00:00
14MAY22:00:00:00
15MAY22:00:00:00
21MAY22:00:00:00
22MAY22:00:00:00
28MAY22:00:00:00
29MAY22:00:00:00
04JUN22:00:00:00
05JUN22:00:00:00
11JUN22:00:00:00
12JUN22:00:00:00
18JUN22:00:00:00
19JUN22:00:00:00
25JUN22:00:00:00
26JUN22:00:00:00
02JUL22:00:00:00
03JUL22:00:00:00
09JUL22:00:00:00
10JUL22:00:00:00
16JUL22:00:00:00
17JUL22:00:00:00
23JUL22:00:00:00
24JUL22:00:00:00
30JUL22:00:00:00
31JUL22:00:00:00
06AUG22:00:00:00
07AUG22:00:00:00
13AUG22:00:00:00
14AUG22:00:00:00
20AUG22:00:00:00
21AUG22:00:00:00
27AUG22:00:00:00
28AUG22:00:00:00
03SEP22:00:00:00
04SEP22:00:00:00
10SEP22:00:00:00
11SEP22:00:00:00
17SEP22:00:00:00
18SEP22:00:00:00
24SEP22:00:00:00
25SEP22:00:00:00
01OCT22:00:00:00
02OCT22:00:00:00
08OCT22:00:00:00
09OCT22:00:00:00
15OCT22:00:00:00
16OCT22:00:00:00
22OCT22:00:00:00
23OCT22:00:00:00
29OCT22:00:00:00
30OCT22:00:00:00
05NOV22:00:00:00
06NOV22:00:00:00
12NOV22:00:00:00
13NOV22:00:00:00
19NOV22:00:00:00
20NOV22:00:00:00
26NOV22:00:00:00
27NOV22:00:00:00
03DEC22:00:00:00
04DEC22:00:00:00
10DEC22:00:00:00
11DEC22:00:00:00
17DEC22:00:00:00
18DEC22:00:00:00
24DEC22:00:00:00
25DEC22:00:00:00
31DEC22:00:00:00
01JAN23:00:00:00
07JAN23:00:00:00
08JAN23:00:00:00
14JAN23:00:00:00
15JAN23:00:00:00
21JAN23:00:00:00
22JAN23:00:00:00
28JAN23:00:00:00
29JAN23:00:00:00
04FEB23:00:00:00
05FEB23:00:00:00
11FEB23:00:00:00
12FEB23:00:00:00
18FEB23:00:00:00
19FEB23:00:00:00
25FEB23:00:00:00
26FEB23:00:00:00
04MAR23:00:00:00
05MAR23:00:00:00
11MAR23:00:00:00
12MAR23:00:00:00
18MAR23:00:00:00
19MAR23:00:00:00
25MAR23:00:00:00
26MAR23:00:00:00
01APR23:00:00:00
02APR23:00:00:00
08APR23:00:00:00
09APR23:00:00:00
15APR23:00:00:00
16APR23:00:00:00
22APR23:00:00:00
23APR23:00:00:00
29APR23:00:00:00
30APR23:00:00:00
06MAY23:00:00:00
07MAY23:00:00:00
13MAY23:00:00:00
14MAY23:00:00:00
20MAY23:00:00:00
21MAY23:00:00:00
27MAY23:00:00:00
28MAY23:00:00:00
03JUN23:00:00:00
04JUN23:00:00:00
10JUN23:00:00:00
11JUN23:00:00:00
17JUN23:00:00:00
18JUN23:00:00:00
24JUN23:00:00:00
25JUN23:00:00:00
01JUL23:00:00:00
02JUL23:00:00:00
08JUL23:00:00:00
09JUL23:00:00:00
15JUL23:00:00:00
16JUL23:00:00:00
22JUL23:00:00:00
23JUL23:00:00:00
29JUL23:00:00:00
30JUL23:00:00:00
05AUG23:00:00:00
06AUG23:00:00:00
12AUG23:00:00:00
13AUG23:00:00:00
19AUG23:00:00:00
20AUG23:00:00:00
26AUG23:00:00:00
27AUG23:00:00:00
02SEP23:00:00:00
03SEP23:00:00:00
09SEP23:00:00:00
10SEP23:00:00:00
16SEP23:00:00:00
17SEP23:00:00:00
23SEP23:00:00:00
24SEP23:00:00:00
30SEP23:00:00:00
01OCT23:00:00:00
07OCT23:00:00:00
08OCT23:00:00:00
14OCT23:00:00:00
15OCT23:00:00:00
21OCT23:00:00:00
22OCT23:00:00:00
28OCT23:00:00:00
29OCT23:00:00:00
04NOV23:00:00:00
05NOV23:00:00:00
11NOV23:00:00:00
12NOV23:00:00:00
18NOV23:00:00:00
19NOV23:00:00:00
25NOV23:00:00:00
26NOV23:00:00:00
02DEC23:00:00:00
03DEC23:00:00:00
09DEC23:00:00:00
10DEC23:00:00:00
16DEC23:00:00:00
17DEC23:00:00:00
23DEC23:00:00:00
24DEC23:00:00:00
30DEC23:00:00:00
31DEC23:00:00:00
06JAN24:00:00:00
07JAN24:00:00:00
13JAN24:00:00:00
14JAN24:00:00:00
20JAN24:00:00:00
21JAN24:00:00:00
27JAN24:00:00:00
28JAN24:00:00:00
03FEB24:00:00:00
04FEB24:00:00:00
10FEB24:00:00:00
11FEB24:00:00:00
17FEB24:00:00:00
18FEB24:00:00:00
24FEB24:00:00:00
25FEB24:00:00:00
02MAR24:00:00:00
03MAR24:00:00:00
09MAR24:00:00:00
10MAR24:00:00:00
16MAR24:00:00:00
17MAR24:00:00:00
23MAR24:00:00:00
24MAR24:00:00:00
30MAR24:00:00:00
31MAR24:00:00:00
06APR24:00:00:00
07APR24:00:00:00
13APR24:00:00:00
14APR24:00:00:00
20APR24:00:00:00
21APR24:00:00:00
27APR24:00:00:00
28APR24:00:00:00
04MAY24:00:00:00
05MAY24:00:00:00
11MAY24:00:00:00
12MAY24:00:00:00
18MAY24:00:00:00
19MAY24:00:00:00
25MAY24:00:00:00
26MAY24:00:00:00
01JUN24:00:00:00
02JUN24:00:00:00
08JUN24:00:00:00
09JUN24:00:00:00
15JUN24:00:00:00
16JUN24:00:00:00
22JUN24:00:00:00
23JUN24:00:00:00
29JUN24:00:00:00
30JUN24:00:00:00
06JUL24:00:00:00
07JUL24:00:00:00
13JUL24:00:00:00
14JUL24:00:00:00
20JUL24:00:00:00
21JUL24:00:00:00
27JUL24:00:00:00
28JUL24:00:00:00
03AUG24:00:00:00
04AUG24:00:00:00
10AUG24:00:00:00
11AUG24:00:00:00
17AUG24:00:00:00
18AUG24:00:00:00
24AUG24:00:00:00
25AUG24:00:00:00
31AUG24:00:00:00
01SEP24:00:00:00
07SEP24:00:00:00
08SEP24:00:00:00
14SEP24:00:00:00
15SEP24:00:00:00
21SEP24:00:00:00
22SEP24:00:00:00
28SEP24:00:00:00
29SEP24:00:00:00
05OCT24:00:00:00
06OCT24:00:00:00
12OCT24:00:00:00
13OCT24:00:00:00
19OCT24:00:00:00
20OCT24:00:00:00
26OCT24:00:00:00
27OCT24:00:00:00
02NOV24:00:00:00
03NOV24:00:00:00
09NOV24:00:00:00
10NOV24:00:00:00
16NOV24:00:00:00
17NOV24:00:00:00
23NOV24:00:00:00
24NOV24:00:00:00
30NOV24:00:00:00
01DEC24:00:00:00
07DEC24:00:00:00
08DEC24:00:00:00
14DEC24:00:00:00
15DEC24:00:00:00
21DEC24:00:00:00
22DEC24:00:00:00
28DEC24:00:00:00
29DEC24:00:00:00
04JAN25:00:00:00
05JAN25:00:00:00
11JAN25:00:00:00
12JAN25:00:00:00
18JAN25:00:00:00
19JAN25:00:00:00
25JAN25:00:00:00
26JAN25:00:00:00
01FEB25:00:00:00
02FEB25:00:00:00
08FEB25:00:00:00
09FEB25:00:00:00
15FEB25:00:00:00
16FEB25:00:00:00
22FEB25:00:00:00
23FEB25:00:00:00
01MAR25:00:00:00
02MAR25:00:00:00
08MAR25:00:00:00
09MAR25:00:00:00
15MAR25:00:00:00
16MAR25:00:00:00
22MAR25:00:00:00
23MAR25:00:00:00
29MAR25:00:00:00
30MAR25:00:00:00
05APR25:00:00:00
06APR25:00:00:00
12APR25:00:00:00
13APR25:00:00:00
19APR25:00:00:00
20APR25:00:00:00
26APR25:00:00:00
27APR25:00:00:00
03MAY25:00:00:00
04MAY25:00:00:00
10MAY25:00:00:00
11MAY25:00:00:00
17MAY25:00:00:00
18MAY25:00:00:00
24MAY25:00:00:00
25MAY25:00:00:00
31MAY25:00:00:00
01JUN25:00:00:00
07JUN25:00:00:00
08JUN25:00:00:00
14JUN25:00:00:00
15JUN25:00:00:00
21JUN25:00:00:00
22JUN25:00:00:00
28JUN25:00:00:00
29JUN25:00:00:00
05JUL25:00:00:00
06JUL25:00:00:00
12JUL25:00:00:00
13JUL25:00:00:00
19JUL25:00:00:00
20JUL25:00:00:00
26JUL25:00:00:00
27JUL25:00:00:00
02AUG25:00:00:00
03AUG25:00:00:00
09AUG25:00:00:00
10AUG25:00:00:00
16AUG25:00:00:00
17AUG25:00:00:00
23AUG25:00:00:00
24AUG25:00:00:00
30AUG25:00:00:00
31AUG25:00:00:00
06SEP25:00:00:00
07SEP25:00:00:00
13SEP25:00:00:00
14SEP25:00:00:00
20SEP25:00:00:00
21SEP25:00:00:00
27SEP25:00:00:00
28SEP25:00:00:00
04OCT25:00:00:00
05OCT25:00:00:00
11OCT25:00:00:00
12OCT25:00:00:00
18OCT25:00:00:00
19OCT25:00:00:00
25OCT25:00:00:00
26OCT25:00:00:00
01NOV25:00:00:00
02NOV25:00:00:00
08NOV25:00:00:00
09NOV25:00:00:00
15NOV25:00:00:00
16NOV25:00:00:00
22NOV25:00:00:00
23NOV25:00:00:00
29NOV25:00:00:00
30NOV25:00:00:00
06DEC25:00:00:00
07DEC25:00:00:00
13DEC25:00:00:00
14DEC25:00:00:00
20DEC25:00:00:00
21DEC25:00:00:00
27DEC25:00:00:00
28DEC25:00:00:00
03JAN26:00:00:00
04JAN26:00:00:00
10JAN26:00:00:00
11JAN26:00:00:00
17JAN26:00:00:00
18JAN26:00:00:00
24JAN26:00:00:00
25JAN26:00:00:00
31JAN26:00:00:00
01FEB26:00:00:00
07FEB26:00:00:00
08FEB26:00:00:00
14FEB26:00:00:00
15FEB26:00:00:00
21FEB26:00:00:00
22FEB26:00:00:00
28FEB26:00:00:00
01MAR26:00:00:00
07MAR26:00:00:00
08MAR26:00:00:00
14MAR26:00:00:00
15MAR26:00:00:00
21MAR26:00:00:00
22MAR26:00:00:00
28MAR26:00:00:00
29MAR26:00:00:00
04APR26:00:00:00
05APR26:00:00:00
11APR26:00:00:00
12APR26:00:00:00
18APR26:00:00:00
19APR26:00:00:00
25APR26:00:00:00
26APR26:00:00:00
02MAY26:00:00:00
03MAY26:00:00:00
09MAY26:00:00:00
10MAY26:00:00:00
16MAY26:00:00:00
17MAY26:00:00:00
23MAY26:00:00:00
24MAY26:00:00:00
30MAY26:00:00:00
31MAY26:00:00:00
06JUN26:00:00:00
07JUN26:00:00:00
13JUN26:00:00:00
14JUN26:00:00:00
20JUN26:00:00:00
21JUN26:00:00:00
27JUN26:00:00:00
28JUN26:00:00:00
04JUL26:00:00:00
05JUL26:00:00:00
11JUL26:00:00:00
12JUL26:00:00:00
18JUL26:00:00:00
19JUL26:00:00:00
25JUL26:00:00:00
26JUL26:00:00:00
01AUG26:00:00:00
02AUG26:00:00:00
08AUG26:00:00:00
09AUG26:00:00:00
15AUG26:00:00:00
16AUG26:00:00:00
22AUG26:00:00:00
23AUG26:00:00:00
29AUG26:00:00:00
30AUG26:00:00:00
05SEP26:00:00:00
06SEP26:00:00:00
12SEP26:00:00:00
13SEP26:00:00:00
19SEP26:00:00:00
20SEP26:00:00:00
26SEP26:00:00:00
27SEP26:00:00:00
03OCT26:00:00:00
04OCT26:00:00:00
10OCT26:00:00:00
11OCT26:00:00:00
17OCT26:00:00:00
18OCT26:00:00:00
24OCT26:00:00:00
25OCT26:00:00:00
31OCT26:00:00:00
01NOV26:00:00:00
07NOV26:00:00:00
08NOV26:00:00:00
14NOV26:00:00:00
15NOV26:00:00:00
21NOV26:00:00:00
22NOV26:00:00:00
28NOV26:00:00:00
29NOV26:00:00:00
05DEC26:00:00:00
06DEC26:00:00:00
12DEC26:00:00:00
13DEC26:00:00:00
19DEC26:00:00:00
20DEC26:00:00:00
26DEC26:00:00:00
27DEC26:00:00:00
02JAN27:00:00:00
03JAN27:00:00:00
09JAN27:00:00:00
10JAN27:00:00:00
16JAN27:00:00:00
17JAN27:00:00:00
23JAN27:00:00:00
24JAN27:00:00:00
30JAN27:00:00:00
31JAN27:00:00:00
06FEB27:00:00:00
07FEB27:00:00:00
13FEB27:00:00:00
14FEB27:00:00:00
20FEB27:00:00:00
21FEB27:00:00:00
27FEB27:00:00:00
28FEB27:00:00:00
06MAR27:00:00:00
07MAR27:00:00:00
13MAR27:00:00:00
14MAR27:00:00:00
20MAR27:00:00:00
21MAR27:00:00:00
27MAR27:00:00:00
28MAR27:00:00:00
03APR27:00:00:00
04APR27:00:00:00
10APR27:00:00:00
11APR27:00:00:00
17APR27:00:00:00
18APR27:00:00:00
24APR27:00:00:00
25APR27:00:00:00
01MAY27:00:00:00
02MAY27:00:00:00
08MAY27:00:00:00
09MAY27:00:00:00
15MAY27:00:00:00
16MAY27:00:00:00
22MAY27:00:00:00
23MAY27:00:00:00
29MAY27:00:00:00
30MAY27:00:00:00
05JUN27:00:00:00
06JUN27:00:00:00
12JUN27:00:00:00
13JUN27:00:00:00
19JUN27:00:00:00
20JUN27:00:00:00
26JUN27:00:00:00
27JUN27:00:00:00
03JUL27:00:00:00
04JUL27:00:00:00
10JUL27:00:00:00
11JUL27:00:00:00
17JUL27:00:00:00
18JUL27:00:00:00
24JUL27:00:00:00
25JUL27:00:00:00
31JUL27:00:00:00
01AUG27:00:00:00
07AUG27:00:00:00
08AUG27:00:00:00
14AUG27:00:00:00
15AUG27:00:00:00
21AUG27:00:00:00
22AUG27:00:00:00
28AUG27:00:00:00
29AUG27:00:00:00
04SEP27:00:00:00
05SEP27:00:00:00
11SEP27:00:00:00
12SEP27:00:00:00
18SEP27:00:00:00
19SEP27:00:00:00
25SEP27:00:00:00
26SEP27:00:00:00
02OCT27:00:00:00
03OCT27:00:00:00
09OCT27:00:00:00
10OCT27:00:00:00
16OCT27:00:00:00
17OCT27:00:00:00
23OCT27:00:00:00
24OCT27:00:00:00
30OCT27:00:00:00
31OCT27:00:00:00
06NOV27:00:00:00
07NOV27:00:00:00
13NOV27:00:00:00
14NOV27:00:00:00
20NOV27:00:00:00
21NOV27:00:00:00
27NOV27:00:00:00
28NOV27:00:00:00
04DEC27:00:00:00
05DEC27:00:00:00
11DEC27:00:00:00
12DEC27:00:00:00
18DEC27:00:00:00
19DEC27:00:00:00
25DEC27:00:00:00
26DEC27:00:00:00
01JAN28:00:00:00
02JAN28:00:00:00
08JAN28:00:00:00
09JAN28:00:00:00
15JAN28:00:00:00
16JAN28:00:00:00
22JAN28:00:00:00
23JAN28:00:00:00
29JAN28:00:00:00
30JAN28:00:00:00
05FEB28:00:00:00
06FEB28:00:00:00
12FEB28:00:00:00
13FEB28:00:00:00
19FEB28:00:00:00
20FEB28:00:00:00
26FEB28:00:00:00
27FEB28:00:00:00
04MAR28:00:00:00
05MAR28:00:00:00
11MAR28:00:00:00
12MAR28:00:00:00
18MAR28:00:00:00
19MAR28:00:00:00
25MAR28:00:00:00
26MAR28:00:00:00
01APR28:00:00:00
02APR28:00:00:00
08APR28:00:00:00
09APR28:00:00:00
15APR28:00:00:00
16APR28:00:00:00
22APR28:00:00:00
23APR28:00:00:00
29APR28:00:00:00
30APR28:00:00:00
06MAY28:00:00:00
07MAY28:00:00:00
13MAY28:00:00:00
14MAY28:00:00:00
20MAY28:00:00:00
21MAY28:00:00:00
27MAY28:00:00:00
28MAY28:00:00:00
03JUN28:00:00:00
04JUN28:00:00:00
10JUN28:00:00:00
11JUN28:00:00:00
17JUN28:00:00:00
18JUN28:00:00:00
24JUN28:00:00:00
25JUN28:00:00:00
01JUL28:00:00:00
02JUL28:00:00:00
08JUL28:00:00:00
09JUL28:00:00:00
15JUL28:00:00:00
16JUL28:00:00:00
22JUL28:00:00:00
23JUL28:00:00:00
29JUL28:00:00:00
30JUL28:00:00:00
05AUG28:00:00:00
06AUG28:00:00:00
12AUG28:00:00:00
13AUG28:00:00:00
19AUG28:00:00:00
20AUG28:00:00:00
26AUG28:00:00:00
27AUG28:00:00:00
02SEP28:00:00:00
03SEP28:00:00:00
09SEP28:00:00:00
10SEP28:00:00:00
16SEP28:00:00:00
17SEP28:00:00:00
23SEP28:00:00:00
24SEP28:00:00:00
30SEP28:00:00:00
01OCT28:00:00:00
07OCT28:00:00:00
08OCT28:00:00:00
14OCT28:00:00:00
15OCT28:00:00:00
21OCT28:00:00:00
22OCT28:00:00:00
28OCT28:00:00:00
29OCT28:00:00:00
04NOV28:00:00:00
05NOV28:00:00:00
11NOV28:00:00:00
12NOV28:00:00:00
18NOV28:00:00:00
19NOV28:00:00:00
25NOV28:00:00:00
26NOV28:00:00:00
02DEC28:00:00:00
03DEC28:00:00:00
09DEC28:00:00:00
10DEC28:00:00:00
16DEC28:00:00:00
17DEC28:00:00:00
23DEC28:00:00:00
24DEC28:00:00:00
30DEC28:00:00:00
31DEC28:00:00:00
06JAN29:00:00:00
07JAN29:00:00:00
13JAN29:00:00:00
14JAN29:00:00:00
20JAN29:00:00:00
21JAN29:00:00:00
27JAN29:00:00:00
28JAN29:00:00:00
03FEB29:00:00:00
04FEB29:00:00:00
10FEB29:00:00:00
11FEB29:00:00:00
17FEB29:00:00:00
18FEB29:00:00:00
24FEB29:00:00:00
25FEB29:00:00:00
03MAR29:00:00:00
04MAR29:00:00:00
10MAR29:00:00:00
11MAR29:00:00:00
17MAR29:00:00:00
18MAR29:00:00:00
24MAR29:00:00:00
25MAR29:00:00:00
31MAR29:00:00:00
01APR29:00:00:00
07APR29:00:00:00
08APR29:00:00:00
14APR29:00:00:00
15APR29:00:00:00
21APR29:00:00:00
22APR29:00:00:00
28APR29:00:00:00
29APR29:00:00:00
05MAY29:00:00:00
06MAY29:00:00:00
12MAY29:00:00:00
13MAY29:00:00:00
19MAY29:00:00:00
20MAY29:00:00:00
26MAY29:00:00:00
27MAY29:00:00:00
02JUN29:00:00:00
03JUN29:00:00:00
09JUN29:00:00:00
10JUN29:00:00:00
16JUN29:00:00:00
17JUN29:00:00:00
23JUN29:00:00:00
24JUN29:00:00:00
30JUN29:00:00:00
01JUL29:00:00:00
07JUL29:00:00:00
08JUL29:00:00:00
14JUL29:00:00:00
15JUL29:00:00:00
21JUL29:00:00:00
22JUL29:00:00:00
28JUL29:00:00:00
29JUL29:00:00:00
04AUG29:00:00:00
05AUG29:00:00:00
11AUG29:00:00:00
12AUG29:00:00:00
18AUG29:00:00:00
19AUG29:00:00:00
25AUG29:00:00:00
26AUG29:00:00:00
01SEP29:00:00:00
02SEP29:00:00:00
08SEP29:00:00:00
09SEP29:00:00:00
15SEP29:00:00:00
16SEP29:00:00:00
22SEP29:00:00:00
23SEP29:00:00:00
29SEP29:00:00:00
30SEP29:00:00:00
06OCT29:00:00:00
07OCT29:00:00:00
13OCT29:00:00:00
14OCT29:00:00:00
20OCT29:00:00:00
21OCT29:00:00:00
27OCT29:00:00:00
28OCT29:00:00:00
03NOV29:00:00:00
04NOV29:00:00:00
10NOV29:00:00:00
11NOV29:00:00:00
17NOV29:00:00:00
18NOV29:00:00:00
24NOV29:00:00:00
25NOV29:00:00:00
01DEC29:00:00:00
02DEC29:00:00:00
08DEC29:00:00:00
09DEC29:00:00:00
15DEC29:00:00:00
16DEC29:00:00:00
22DEC29:00:00:00
23DEC29:00:00:00
29DEC29:00:00:00
30DEC29:00:00:00
05JAN30:00:00:00
06JAN30:00:00:00
12JAN30:00:00:00
13JAN30:00:00:00
19JAN30:00:00:00
20JAN30:00:00:00
26JAN30:00:00:00
27JAN30:00:00:00
02FEB30:00:00:00
03FEB30:00:00:00
09FEB30:00:00:00
10FEB30:00:00:00
16FEB30:00:00:00
17FEB30:00:00:00
23FEB30:00:00:00
24FEB30:00:00:00
02MAR30:00:00:00
03MAR30:00:00:00
09MAR30:00:00:00
10MAR30:00:00:00
16MAR30:00:00:00
17MAR30:00:00:00
23MAR30:00:00:00
24MAR30:00:00:00
30MAR30:00:00:00
31MAR30:00:00:00
06APR30:00:00:00
07APR30:00:00:00
13APR30:00:00:00
14APR30:00:00:00
20APR30:00:00:00
21APR30:00:00:00
27APR30:00:00:00
28APR30:00:00:00
04MAY30:00:00:00
05MAY30:00:00:00
11MAY30:00:00:00
12MAY30:00:00:00
18MAY30:00:00:00
19MAY30:00:00:00
25MAY30:00:00:00
26MAY30:00:00:00
01JUN30:00:00:00
02JUN30:00:00:00
08JUN30:00:00:00
09JUN30:00:00:00
15JUN30:00:00:00
16JUN30:00:00:00
22JUN30:00:00:00
23JUN30:00:00:00
29JUN30:00:00:00
30JUN30:00:00:00
06JUL30:00:00:00
07JUL30:00:00:00
13JUL30:00:00:00
14JUL30:00:00:00
20JUL30:00:00:00
21JUL30:00:00:00
27JUL30:00:00:00
28JUL30:00:00:00
03AUG30:00:00:00
04AUG30:00:00:00
10AUG30:00:00:00
11AUG30:00:00:00
17AUG30:00:00:00
18AUG30:00:00:00
24AUG30:00:00:00
25AUG30:00:00:00
31AUG30:00:00:00
01SEP30:00:00:00
07SEP30:00:00:00
08SEP30:00:00:00
14SEP30:00:00:00
15SEP30:00:00:00
21SEP30:00:00:00
22SEP30:00:00:00
28SEP30:00:00:00
29SEP30:00:00:00
05OCT30:00:00:00
06OCT30:00:00:00
12OCT30:00:00:00
13OCT30:00:00:00
19OCT30:00:00:00
20OCT30:00:00:00
26OCT30:00:00:00
27OCT30:00:00:00
02NOV30:00:00:00
03NOV30:00:00:00
09NOV30:00:00:00
10NOV30:00:00:00
16NOV30:00:00:00
17NOV30:00:00:00
23NOV30:00:00:00
24NOV30:00:00:00
30NOV30:00:00:00
01DEC30:00:00:00
07DEC30:00:00:00
08DEC30:00:00:00
14DEC30:00:00:00
15DEC30:00:00:00
21DEC30:00:00:00
22DEC30:00:00:00
28DEC30:00:00:00
29DEC30:00:00:00
04JAN31:00:00:00
05JAN31:00:00:00
11JAN31:00:00:00
12JAN31:00:00:00
18JAN31:00:00:00
19JAN31:00:00:00
25JAN31:00:00:00
26JAN31:00:00:00
01FEB31:00:00:00
02FEB31:00:00:00
08FEB31:00:00:00
09FEB31:00:00:00
15FEB31:00:00:00
16FEB31:00:00:00
22FEB31:00:00:00
23FEB31:00:00:00
01MAR31:00:00:00
02MAR31:00:00:00
08MAR31:00:00:00
09MAR31:00:00:00
15MAR31:00:00:00
16MAR31:00:00:00
22MAR31:00:00:00
23MAR31:00:00:00
29MAR31:00:00:00
30MAR31:00:00:00
05APR31:00:00:00
06APR31:00:00:00
12APR31:00:00:00
13APR31:00:00:00
19APR31:00:00:00
20APR31:00:00:00
26APR31:00:00:00
27APR31:00:00:00
03MAY31:00:00:00
04MAY31:00:00:00
10MAY31:00:00:00
11MAY31:00:00:00
17MAY31:00:00:00
18MAY31:00:00:00
24MAY31:00:00:00
25MAY31:00:00:00
31MAY31:00:00:00
01JUN31:00:00:00
07JUN31:00:00:00

I hope you can lead me in the right direction.


Solution

  • Your example list is small enough (1000 dates) that it could fit into a macro variable, at least when represented as DATE values instead of DATETIME values.

    So if you have a variable named VACATION_DTTM in a dataset named IGNORE_DAYS you could make a macro variable with a list of the date values to be excluded.

    proc sql noprint;
      select datepart(vacation_dttm) format=7. into :ignore_dates separated by ' '
      from ignore_days;
    quit;
    

    Then you could use that list in your data step code.

    data _null_;
       do date="&REPORTING_Bank_DTTM"d-1 by -1 while (date in (&ignore_days));
       end;
       call symputx('REPORTING_Bank_DTTM',put(date,date9.)||':00:00:00');
    run;
    

    If the list gets larger then you might want to uses a HASH() object instead. If the values in the dataset are DATETIME instead of DATE then you will need to use INTNX() function to move by days instead of simple subtraction.

    data _null_;
      declare hash h(dataset:'ignore_days');
      rc=h.definekey('vacation_dttm');
      rc=h.definedata('vacation_dttm');
      rc=h.definedone();
      vacation_dttm="&REPORTING_Bank_DTTM"dt;
      do until (h.find());
        vacation_dttm=intnx('dtday',vacation_dttm,-1,'b');
      end;
      call symputx('REPORTING_Bank_DTTM',put(vacation_dttm,datetime19.));
    run;