标题: 为什么会重复??? [打印本页] 作者: shiyiming 时间: 2010-5-18 17:53 标题: 为什么会重复??? [code:1ly8xj31]%macro Merge_data(Prefix =);
data Total;
*--merge Total_data &Prefix;
*--by date;
set Total &Prefix;
run;
%mend;
data Tol;
set Filena;
call execute('%Merge_data(Prefix ='||Prefix||')');
run;[/code:1ly8xj31]
用以上代码实现批量合并已经导入WORK的数据
(假设四个数据集,每个数据集只有变量X Y)合并的结果是
[code:1ly8xj31]x y
1 1
1 1
2 2
1 1
2 2
3 3
1 1
2 2
3 3
4 4[/code:1ly8xj31]
而我希望的结果是:
[code:1ly8xj31]
x y
1 1
2 2
3 3
4 4[/code:1ly8xj31]
What Can I Do?请高手指点迷津 <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->作者: shiyiming 时间: 2010-5-18 21:16 标题: Re: 为什么会重复??? Is the code to combine specified (by set Filena) data sets vertically? I guess something like that
[code:12k415r6]data a b c d;
do x = 1 to 4;
y = x;
select (x);
when (1) output a;
when (2) output b;
when (3) output c;
when (4) output d;
otherwise;
end;
end;
run;
data Filena;
input Prefix $@@; datalines;
a b c d
;
data total;
set _null_;
run;
%macro Merge_data(Prefix =);
data Total;
*--merge Total_data &Prefix;
*--by date;
set Total &Prefix;
run;
%mend;
data Tol;
set Filena;
call execute('%Merge_data(Prefix ='||Prefix||')');
run;[/code:12k415r6]作者: shiyiming 时间: 2010-5-20 00:25 标题: Re: 为什么会重复??? <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> Thanks! I just want to combine the datasets in Filena!!! Your method can do it !!!