35%macro mf_writefile(fpath,mode=O,l1=,l2=,l3=,l4=,l5=,l6=,l7=,l8=,l9=,l10=
37%local fref rc fid i total_lines;
41 %
if %str(&&l&i) ne %str() %then %
goto continue;
46%
if %sysfunc(filename(fref,&fpath)) ne 0 %then %
do;
48 %put %str(ERR)OR: %sysfunc(sysmsg());
52%let fid=%sysfunc(fopen(&fref,&mode));
55 %put %str(ERR)OR: %sysfunc(sysmsg());
59%
do i=1 %to &total_lines;
60 %let rc=%sysfunc(fput(&fid, &&l&i));
61 %let rc=%sysfunc(fwrite(&fid));
63%let rc=%sysfunc(fclose(&fid));
64%let rc=%sysfunc(filename(&fref));