Please internalize this:
SUCCESSFUL MACRO PROGRAMMING STARTS WITH WORKING NON-MACRO CODE!
And also Maxim 34: Work in Steps.
This would have alerted you of the fact that the INDEXW is in fact not finding what you want, and that is because you did not tell it that you use the underline as a delimiter.
See this example where the string is found:
%let nl_rb=0417,0437,0438,0439,0440,0441,0555,1234,0170,1100;
data _null_;
filename = "IFT_GT_RND_2_0417_1_20201009T075212.csv";
flag = 0;
do i = 1 to countw("&nl_rb.",",");
if indexw(filename,scan("&nl_rb.",i,","),"_") then flag = 1;
end;
put flag=;
run;
Log:
73 %let nl_rb=0417,0437,0438,0439,0440,0441,0555,1234,0170,1100;
74
75 data _null_;
76 filename = "IFT_GT_RND_2_0417_1_20201009T075212.csv";
77 flag = 0;
78 do i = 1 to countw("&nl_rb.",",");
79 if indexw(filename,scan("&nl_rb.",i,","),"_") then flag = 1;
80 end;
81 put flag=;
82 run;
flag=1
... View more