there is no "common suffix" handler like the colon modifier indicating a common prefix.
The usual solution requires filling the list of columns into a macro variable by processing the output of proc contents or dictionary.columns. The former is my preference.
proc contents data= your_data_set noprint out= _data_ ; run;
proc sql noprint ;
select name into :list_of_cols separated by ' ' from &syslast
where lowcase(name) like '%_flg' ;
then you can use &list_of_cols
Of course this may be no help (if for example: when you do not have a previously defined data set)
thank you for posting the demo macro to collect from a filter of sashelp.vcolumn.
Have you compared the times? On my -ix SAS system the demo data step takes 11 seconds real and 1.8 cpu seconds.
SAShelp.vcolumn is a list of every column in every table in every library that is assigned in the SAS session, so sometimes it is just slow, and sometimes it is very slow. Because you open the view in data step functions there is no optimisation of the WHERE conditions. When you can open in SQL, filters on libname and memname make the performance a whole lot more acceptable.
Because the macro utility uses only macro code (does not generate DATA step or PROC code), it can be leveraged to generate the variable list in-line with other SAS code, much like the macro functions that ship with SAS.
Querying dictionary.columns in PROC SQL is definitely more efficient in execution, but it is not possible to use the PROC SQL query directly in-line with other SAS code (the query must be "pre-executed") so that approach is somewhat less flexible.
It's good to have options, and in this case having a utility that can be used anywhere may override the performance considerations. And it was an irresistible opportunity to showcase the ability to access data in a purely macro environment... :-)