在 SAS 过程中比较

发布于 2024-08-22 13:57:16 字数 332 浏览 1 评论 0原文

首先,我对 SAS 几乎一无所知,而且我不是程序员而是会计师,但事情是这样的:

我试图比较两个数据集以识别它们之间的差异,所以我使用“proc Compare”命令作为如下所示:

proc compare data=table1 compare=table2
criterion=.01;
run;

这工作正常,但它按行和顺序进行比较,因此如果 table2 中途缺少一行,则该行之后的所有条目都将作为不相等而返回。

如何要求基于变量进行比较,以便 proc 比较找到与表 1 中的变量 X 关联的值,然后确保表 2 中的相同变量 X 具有相同的值?

First off, I know pretty much nothing about SAS and I am not a programmer but an accountant, but here it goes:

I am trying to compare two data sets to identify differences between them, so I am using the 'proc compare' command as follows:

proc compare data=table1 compare=table2
criterion=.01;
run;

This works fine, but it compares line by line and in order, so if table2 is missing a row half way through, then all entries after that row will be returned as not equal.

How do I ask the comparison to be made based on a variable so that the proc compare finds the value associated with variable X in table 1, and then makes sure that the same variable X in table 2 has the same value?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情何以堪。 2024-08-29 13:57:16

PROC COMPARE 中的 ID 语句用于匹配行。此代码可能适合您:

proc compare data=table1 compare=table2 criterion=.01; 
  id X;
run;

在执行 PROC COMPARE 之前,您可能需要使用 PROC SORT 按 X 对数据进行排序。有关 ID 语句的详细信息,请参阅 PROC COMPARE 文档以确定是否应该排序。

以下是 PROC COMPARE 文档的链接:

http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000057814.htm

The ID statement in PROC COMPARE is used to match rows. This code may work for you:

proc compare data=table1 compare=table2 criterion=.01; 
  id X;
run;

You may need to use PROC SORT to sort the data by X before doing the PROC COMPARE. Refer to the PROC COMPARE documentation for details on the ID statement to determine if you should sort or not.

Here is a link to the PROC COMPARE documentation:

http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000057814.htm

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文