我正在寻找一个程序来清理我拥有的一些混乱数据,我希望为我正在从事的项目的资产和负债方面做到这一点。
我的问题是有一种方法可以使用 do 循环来使用清理数据首先清理资产然后清理负债。像这样的东西:
%do %I = Asset %to Liability;
%assetorliability= I ;
proc sort data = &assetorliability;
by price;
run;
data want&assetorliability;
set &assetorliability;
if _N_ < 50000;
run;
实际的脚本很长,所以单个宏可能不是理想的解决方案,但这个循环会很棒。
TIA。
编辑:该程序包含一些宏,收到的错误如下:
%let list =Asset Liability;
%do i=1 %to %sysfunc(countw(&list,%str( )));
%let next=%scan(&list,&i,%str( ));
%Balance;
%end;
在宏中,数据步骤以平衡和列表命名,以允许每个场景。错误是:
13221 %let list =Asset Liability;
13222 %do i=1 %to %sysfunc(countw(&list,%str( )));
ERROR: The %DO statement is not valid in open code.
13223
13224 %let next=%scan(&list,&i,%str( ));
WARNING: Apparent symbolic reference I not resolved.
WARNING: Apparent symbolic reference I not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric
operand is required. The condition was: &i
ERROR: Argument 2 to macro function %SCAN is not a number.
ERROR: The %END statement is not valid in open code.