Do you want the full list of problems? Or just the problems with the part that is trying to gather variable names?
Let's start with the last step:
proc sql;
select * into :charlist separated by ' '
from dictionary.columns
where libname="work" and memname="birthday"
;
quit;
Issues:
Add the NOPRINT option to the PROC SQL so the names are not also printed to the output window.
Specify the actual value you want to put into the macro variable. This would only select the variable NAME if that happens to be the first variable that would get selected by the * shortcut for all varaibles.
Values of LIBNAME and MEMNAME are always uppercase in the DICTIONARY.COLUMNS.
Do you care what order the names appear in the list?
You also need to protect in case VALIDVARNAME option is set to ANY. That means some names might have spaces in them. You can use the NLITERAL() function for example Or use some other character as the separator in the list for values.
proc sql noprint;
select nliteral(name)
into :charlist separated by ' '
from dictionary.columns
where libname="WORK" and memname="BIRTHDAY"
order by varnum
;
quit;
... View more