在sas中的宏中循环参数

在sas中的宏中循环参数,sas,Sas,我开发了一个SAS代码,它有一个带有两个参数的宏。 宏如下所示 %macro compare(country,attributes) 问题是,我有10个国家,例如印度、美国、澳大利亚、巴基斯坦等,还有15个属性,例如语言、地区、货币、寿命、男性比例等 所以我得给宏打150次电话 %compare(India,language); %compare(India,area); %compare(India,currency); * ; /* Similarly I have do the sam

我开发了一个SAS代码,它有一个带有两个参数的宏。 宏如下所示

%macro compare(country,attributes)
问题是,我有10个国家,例如印度、美国、澳大利亚、巴基斯坦等,还有15个属性,例如语言、地区、货币、寿命、男性比例等

所以我得给宏打150次电话

%compare(India,language);
%compare(India,area);
%compare(India,currency);
*  ;
/* Similarly I have do the same for other attributes also */
*   ;
%compare(U.S.A,language)
%compare(U.S.A,area)
/* Similarly I have do the same for other countries also */
*;
*;
*;

有没有办法将这些属性和国家名称作为数组并循环使用以获得相同的结果?sas的新成员。提前感谢您的帮助

我建议1。将您的国家/地区和属性放入SAS表“country\u attr”,其中包含变量“country”和“attributes”。2.调用执行:

data _null_;
 set country_attr;
 call execute ('%compare('||country||','||attributes')');
 run;

我建议1。将您的国家/地区和属性放入SAS表“country\u attr”,其中包含变量“country”和“attributes”。2.调用执行:

data _null_;
 set country_attr;
 call execute ('%compare('||country||','||attributes')');
 run;

它们的长度不一样。有可能吗?长度?如果您指的是变量/宏变量长度,那么这不重要。只要确保在构建SAS表时,设置的长度足以承载它们。还有其他方法吗?使用循环?这是循环,数据步隐式循环。两者的长度不同。有可能吗?长度?如果您指的是变量/宏变量长度,那么这不重要。只要确保在构建SAS表时,设置的长度足以承载它们。还有其他方法吗?使用循环?这是循环,数据步骤隐式循环。