In reply to Jiangtang Hu.

Thank you Jiangtang, this has been very helpful!

What exactly is this part of the code doing?

proc sql;
select memname into:d separated by ','
from dictionary.tables
where upcase(libname)="WORK" and upcase(substr(memname,1,3))="__D"
;
quit;