Here is a solution.
data one;
retain a1-a5
abcd_id dg_id tged_id yu433rf_id uhewgtg45_id
z1-z6 0;
run;
proc print;run;
proc sql noprint;
select name into: keepit separated by ' '
from dictionary.columns
where libname in ('WORK') and memname in ('ONE')
and upcase(name) like '%_ID';
quit;
data two;
set one(keep=&keepit);
run;
proc print;run;