I have a large data set that has approximately 100 names of managers. Now, I need to export the data by manager name so that I have a single dataset for each manager. I am able to use a macro to create a separate dataset for each manager (essentially, a category) using the code:
%macro break(byval);
data &byval;
set final(where=(Project_Manager_Name="&byval"));
run;
%mend;
data _null_;
set final;
by Project_Manager_Name;
if first.Project_Manager_Name then
call execute(%nrstr('%break('||trim(Project_Manager_Name)||')'));
run;
This is where I get stuck. I just need .xlsx files of each and include the name of the manager at the end of each file name, like:
proc export
data = final
dbms = xlsx
outfile = "&OUTPUT.\Final_Report_ManagerName.xlsx"
replace;
run;
I assume I put the &byval
macro variable somewhere in the outfile name, but I'm still getting errors that it's not being reference. Any insight?