@PaigeMiller wrote: I have written a macro, and it works fine until the ODS EXCEL command. The macro extracts some data from data bases, based upon macro arguments, does some calculations, and then tries to creates a table via ODS EXCEL. I have removed from this example the stuff that works properly, as there are no errors in the log. %macro monitoring2(startdate1=,enddate1=,startdate2=,enddate2=,
no_rates_lastXweeks=2,graphics_only=0,debug=0,outxlsx=,acaps=1);
%put;
%put &=outxlsx;
%put;
ods excel file="&outxlsx" options(sheet_name='Data');
proc report data=_stats1a_;
columns method week _freq_ booking_rate approval_rate conversion_rate exception_rate;
define method/group 'Method' order=data;
define week/group "Week" format=wff. order=internal;
define booking_rate/display 'Booking Rate';
define _freq_/display 'N Apps' format=comma10.0;
define approval_rate/display 'Approval Rate';
define conversion_rate/display 'Conversion Rate';
define exception_rate/display 'Exception Rate';
compute week;
if week=1e10 then call define(_row_,'style','style={color=verydarkblue fontweight=bold background=lightyellow}');
endcompute;
run;
ods excel close;
%mend;
%monitoring2(startdate1=01JUL19,enddate1=31JUL19,
startdate2=01AUG19,debug=1,graphics_only=1,
outxlsx=&pers\ias2\testplots3.xlsx,acaps=0)
Now, here's the log. Note that the %PUT statement shows that the macro variable &OUTXLSX has the desired value, it hasn't changed (shown in red). The error occurs in the ODS EXCEL command, and not in the PROC REPORT. The file name, which is correct in &OUTXLSX, has C:\Users... etc. prepended to the value of &OUTXLSX, and of course, there is no such folder once the mysterious addition to &OUTXLSX happens. Why? 9503 %monitoring2(startdate1=01JUL19,enddate1=31JUL19,
startdate2=01AUG19,debug=1,graphics_only=1,
outxlsx=&pers\ias2\testplots3.xlsx)
OUTXLSX=G:\Team12\Credit Risk Oversight\Retail Risk\Users\MillerP\ias2\testplots3.xlsx
MPRINT(MONITORING2): ods excel file="G:\Team12\Credit Risk Oversight\Retail Risk\Users\MillerP\ias2\testplots3.xlsx" options(sheet_name='Data');
NOTE: Writing EXCEL Body file: G:\Team12\Credit Risk Oversight\Retail Risk\Users\MillerP\ias2\testplots3.xlsx
ERROR: A component of C:\Users\eccrpm0\AppData\Local\Temp\SAS Temporary Files\_TD16364_PCVPTWX6VP00119_\_T00000000069D5120\G:\Team12\Credit Risk
Oversight\Retail Risk\Users\MillerP\ias2\testplots3.xlsx is not a directory.
ERROR: No body file. EXCEL output will not be created. Just for completeness, the macro variable &pers in the call to the macro resolves as G:\Team12\Credit Risk Oversight\Retail Risk\Users\MillerP, so &OUTXLSX does indeed have the desired folder location. Maybe this note is applicable: http://support.sas.com/kb/15/046.html and this (they seem related): http://support.sas.com/kb/61/280.html If you are using z/OS you might be out of luck: http://support.sas.com/kb/62/838.html
... View more