【发布时间】:2023-03-25 11:21:01
【问题描述】:
我有一个包含大约 100 个经理姓名的大型数据集。现在,我需要按经理名称导出数据,以便每个经理都有一个数据集。我可以使用宏使用代码为每个经理(本质上是一个类别)创建一个单独的数据集:
%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;
这就是我卡住的地方。我只需要每个文件的 .xlsx 文件,并在每个文件名的末尾包含管理器的名称,例如:
proc export
data = final
dbms = xlsx
outfile = "&OUTPUT.\Final_Report_ManagerName.xlsx"
replace;
run;
我假设我将 &byval 宏变量放在了输出文件名的某个位置,但我仍然收到错误,表明它没有被引用。有什么见解吗?
【问题讨论】:
-
将您的 proc 导出移动到您的中断宏中,用 outfile 中的经理名称替换所有。