27%macro mp_cleancsv(in=NOTPROVIDED,out=NOTPROVIDED,qchar=
'22'x);
28%
if "&in"=
"NOTPROVIDED" or
"&out"=
"NOTPROVIDED" %then %
do;
29 %put %str(ERR)OR: Please provide valid input (&in) & output (&out) locations;
34%
if %index(&in,.) %then %let in=
"&in";
35%
if %index(&out,.) %then %let out=
"&out";
44 retain isq iscrlf 0 qchar &qchar;
45 input inchar $char1. ;
46 if inchar=qchar then isq = mod(isq+1,2);
49 if inchar=
'0D'x then
do;
52 if inchar ne
'0A'x then
do;
54 if inchar=qchar then isq = mod(isq+1,2);
57 else put inchar $char1.;
61 if inchar=
'0D'x then
do;
65 if inchar=
'0D'x then
do;
69 else if inchar ne
'0A'x then
do;
71 if inchar=qchar then isq = mod(isq+1,2);
74 else if inchar=
'0A'x then put
'0D0A'x;
75 else put inchar $char1.;