18 %macro mp_ds2csv(ds, outref=0, outfile=, outencoding=0
21 %
if not %sysfunc(exist(&ds)) %then %
do;
22 %put WARNING: &ds does not exist;
26 %
if %index(&ds,.)=0 %then %let ds=WORK.&ds;
28 %
if &outencoding=0 %then %let outencoding=;
29 %
else %let outencoding=encoding=
"&outencoding";
32 %
if &outref=0 %then %let outloc=&outfile;
33 %
else %let outloc=&outref;
39 file &outloc dlm=
',' dsd &outencoding lrecl=32767;
41 dsid=open(
"&ds.",
"i");
42 num=attrn(dsid,
"nvars");
44 header = trim(left(coalescec(varlabel(dsid,i),varname(dsid,i))));
53 file &outloc mod dlm=
',' dsd &outencoding lrecl=32767;