简体   繁体   English

SAS中的合并与设置语句

[英]Merge vs Set statement in SAS

I am wondering if there is any difference between merge and set statements in SAS when using only 1 dataset as source. 我想知道仅使用1个数据集作为源时SAS中的mergeset语句之间是否有任何区别。

For example: 例如:

 data newdata;
 set olddata;
 run;

vs VS

data newdata;
merge olddata;
by identifier;
run;

I cant find any differences in the resulting datasets from each method. 我在每种方法的结果数据集中都找不到任何差异。

Is there any difference between the two statements in a situation like this? 在这种情况下,这两个语句之间有什么区别吗? Thanks. 谢谢。

There is no difference between 两者之间没有区别

data a;
set b;
run;

and

data a;
merge b;
run;

other than the likely warning/error you will receive from the merge statement not having a by statement. 除了可能会从合并语句中收到的不带by语句的警告/错误之外。 If you include the by statement in both, there becomes no difference at all. 如果在两个语句中都包含by语句,则完全没有区别。

Merge is in fact a special case of Set, as KP6's answer explains. 合并实际上是Set的一种特殊情况,正如KP6的答案所解释的。 With only a single dataset, it is identical. 仅只有一个数据集,它是相同的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM