That is easy to use variable LABEL instead of variable name.
data have;
set sashelp.class;
label name='asasf sdfsfe' weight='w sd erbd s';
run;
/*Get variable's label*/
proc sql noprint;
select quote(strip(label)) into :label separated by ','
from dictionary.columns
where libname='WORK' and memname='HAVE';
quit;
data _null_;
set have end=last;
file 'c:\temp\temp.csv' dsd recfm=n;
if _n_=1 then put %sysfunc(quote(%bquote(&label.))) '0D0A'x;
put (_all_) (:);
if not last then put '0D0A'x;
run;
... View more