I don't think this code will do anything. The code as posted has both syntax errors and logic errors.
It appears to be an attempt to generate a list of variables to drop by counting how many times the variable has a value of 1.
The macro is creating macro variables without ever making sure they are defined external to the macro. So macro variables like DROP_LIST will be created as local if they have not already been created before the macro is called. You might add this to the top of the macro:
%local flag_list i flag triggered ;
%if not %symexist(drop_list) %then %global drop_list ;
This line has misplaced semi-colons:
%IF &triggered=0 AND drop_list NE %STR() %THEN; %LET drop_list=%SYSFUNC(CATX(%str( ),&drop_list,&flag)) %ELSE %IF &triggered=0 %THEN %LET drop_list=&flag;
Perhaps they meant:
%IF &triggered=0 AND drop_list NE %STR() %THEN %LET drop_list=%SYSFUNC(CATX(%str( ),&drop_list,&flag));
%ELSE %IF &triggered=0 %THEN %LET drop_list=&flag;
But really all they needed was:
%IF &triggered=0 %THEN %LET drop_list=&drop_list &flag;
There is no need to try to use any of the CAT series functions in macro code. Just expand the macro variables where you want their values to appear.
There is no need to use UPCASE() function on the LIBNAME or MEMNAME fields in SASHELP.VCOLUMN as those values are always upper case.
... View more