Hi,
I'm a novice at SAS macro and am having some issues writing a function which does the following:
takes 3 inputs
1. dataset name (e.g. from a data step)
2. a folder directory where all of various excel outputs will be stored
3. the desired excel file name for the dataset
I have currently written my function as follows:
%make_excel(dataset= , output_path = , filname = );
ods excel file = "&output_path.\&filename..xlsx";
proc report data= &dataset.;
run;
ods excel close;
%mend make_Excel
Presently if I call the function with something like:
%make_excel(dataset= ds, output_path = C:\Users\XXXXX, filename = YYYYY)
everything works fine, which is great. But I need to call the function a bunch of times and I don't want to constantly copy/paste the output path. So I'm trying to set a macro variable such as:
%let out_tmp = C:\Users\XXXXX;
And then call the function by
%make_excel(dataset=ds, output_path = %out_tmp, filename = YYYYYYY)
However, when I am trying this I keep getting an error in the long:
"Error: physical file does not exist, C:\Windows\systsem32\%out_tmp\YYYYY.xlsx"
ChatGPT and google have unfortunately been no help so far. Any idea why this might be occurring?
Thanks!