Your posted code for defining the macro is not correct as the %MACRO statement is wrong. But perhaps that is just a typo since you also say it works.
%macro make_excel(dataset= , output_path = , filname = );
ods excel file = "&output_path.\&filename..xlsx";
proc report data= &dataset.;
run;
ods excel close;
%mend make_excel;
You are not referencing the macro variable OUT_TMP properly in your macro call. You used % instead of &. The % character is used to reference macros statements (like the %MACRO and %MEND in your code) and actual macro functions (like %SUBSTR() and %SCAN()) in addition to being used to reference macros (like %MAKE_EXCEL in your program). The & character is used when you need to reference a macro variable (also known as a symbol). You are using the & properly to reference the macro variables correctly in the body of your macro.
Here is the fixed macro call:
%make_excel(dataset=ds, output_path = &out_tmp, filename = YYYYYYY)
... View more