It is not necessary that all variables in dataset should have label. This solution would print label if available. In the below table, provide libname and table to the macro variables and rest of the code should work itself. %let _libname=; %let _table=; proc sql noprint; select catt( name,'=',quote( catt(label,' (',name,')') ) ) into : embed_names_into_labels separated by ' ' from dictionary.columns where libname="&_libname" and memname="&_table" and not missing(label); quit; But above reply has a point that saying why do you need such a wide report. data temp / view = temp; set &_libname..&_table; label &embed_names_into_labels; run; proc print data=temp label; run;
... View more