【问题标题】:Creating a dataset which is the complement of a subdataset in sas创建一个数据集,它是 sas 中子数据集的补充
【发布时间】:2017-05-03 05:31:33
【问题描述】:

我有两个数据集,其中一个是较大数据集的子集。我想做的是创建一个新数据集,它是较小数据集的补充。有没有办法在 SAS 中做到这一点?

The image shows a snapshot of my data set

较小的数据集是特定肇事者(特别是肇事者 2、14 、15 19)我现在想要一个排除这些人的数据集

【问题讨论】:

标签: sas dataset


【解决方案1】:

您可以使用合并来做到这一点,例如

data want;
  merge large_dataset
              subset(in=subset);
  by id;
  if not(subset);
run;

【讨论】:

  • 对不起,我不太明白。所以大数据集被称为暴力,子集被称为罪犯和他们正在按犯罪者ID排序的变量
【解决方案2】:

使用 SQL 和“不在”

proc sql;
create table_want as
select distinct *
from violence
where perpetratorID not in (2, 14 ,15, 19)
quit;

如果 perpetratorID 不是数字,则 ("2", "14" ,"15", "19")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-08
    • 1970-01-01
    • 1970-01-01
    • 2011-02-16
    • 2020-02-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多