在SAS中构建宏-自动执行宏输入

问题描述

我正在创建的宏是SAS。我已经编写了宏步骤,但无法自动输入值。目前,我正在手动输入它们。有没有一种方法可以编写代码自动从引用表中选择每个值并运行宏。谢谢。让我知道是否需要更多信息。

Reference Table(可以根据输入要求进行更改) Input table

@H_404_5@%macro Cars(manufacturer=,saleslocation1=,saleslocation2=,sales1=,sales2=);

data Company_&manufacturer._1;
set loc_&saleslocation1.;
if first.Profit then rank = 1;
else rank +1;
if rank <= &sales1.;
run;

data Company_&manufacturer._2;
set loc_&saleslocation2.;
if first.Profit then rank = 1;
else rank +1;
if rank <= &sales2.;
run;

data Company_&manufacturer.;
set Company_&manufacturer._1 Company_&manufacturer._2
run;

/* to remove duplicates as some manufacturers has one sales location*/
proc sort data = Company_&manufacturer. nodupkey by _all_; run;
%mend;
%Cars(manufacturer=BMW,saleslocation1=Canada,saleslocation2=China,sales1=25,sales2=35)
%Cars(manufacturer=Audi,saleslocation2=Canada,sales1=100,sales2=100)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)