Merge 如何在SAS中合并此类数据集?

Merge 如何在SAS中合并此类数据集?,merge,sas,enterprise-guide,Merge,Sas,Enterprise Guide,我有两个这样的SAS数据集 数据集A 数据集B 我期望的输出如下所示。这只是数据集A-数据集B 我对SAS非常陌生,因此我无法理解如何合并这两个数据集并找出值之间的差异。我在这里面临的另一个挑战是合并应该在行到行的基础上进行,而不是在列的基础上进行。i、 e.例如 The value in First Column should match with the Value of First column in the Dataset b. Then if that Matches the Val

我有两个这样的SAS数据集

数据集A

数据集B

我期望的输出如下所示。这只是数据集A-数据集B

我对SAS非常陌生,因此我无法理解如何合并这两个数据集并找出值之间的差异。我在这里面临的另一个挑战是合并应该在行到行的基础上进行,而不是在列的基础上进行。i、 e.例如

The value in First Column should match with the Value of First column in the Dataset b. 
Then if that Matches the Values in Second columns should match. If they Match then the values in the 3rd Columns should get subtracted. 
即使我无法合并两个数据集,是否还有其他方法可以找到值之间的差异并将其存储在新的SAS输出文件中

有人能帮我一下吗。提前感谢。

我们将完成以下工作:

data have1;
  m = 'x'; n = 'a'; val = 1; output;
  m = 'x'; n = 'b'; val = 23; output;
  m = 'y'; n = 'e'; val = 12; output;
  m = 'y'; n = 'f'; val = 13; output;
run;

data have2;
  m = 'x'; n = 'a'; val = 2; output;
  m = 'x'; n = 'b'; val = 3; output;
  m = 'y'; n = 'e'; val = 13; output;
  m = 'y'; n = 'f'; val = 15; output;
run;

proc sql;
  create table want as
  select h1.m, h1.n, h1.val - h2.val from have1 h1, have2 h2 where h1.m = h2.m and h1.n = h2.n;
  quit;

实际上,m列在这里不起作用,因为当m改变时,n是唯一的。也许这只是您展示示例的方式

请将您的数据以文本形式发布,并展示您尝试过的内容。您发布的图片看起来不像数据集。变量是什么?这些数据代表什么。它们是数据集还是Excel电子表格?这看起来像是家庭作业。嗨,我为这个不完整的问题道歉。事实上,问题是,在准备问题时,我无法以表格形式发布答案,这就是为什么必须粘贴Excel中的值的原因。我对此非常陌生,并且每天都在学习。非常感谢:这让我了解了如何处理此问题。在SAS中,有没有办法在合并两个数据集之前先删除空行。什么是空行?