【问题标题】:merging two data sets in SAS SQL where columns are slightly different合并列略有不同的SAS SQL中的两个数据集
【发布时间】:2017-08-05 00:25:32
【问题描述】:

我正在使用 PROC SQL 合并两个数据集,其中公共列是名称。但是,一个数据集的第一个初始姓氏(例如 John Smith 将是 jsmith),另一个是 jsmithH。这个 H 位于第二个数据集中每个名称的末尾。如何将这两个数据集合并在一起?我想我需要在两者之间使用某种相似性,但不确定。

【问题讨论】:

    标签: sas


    【解决方案1】:
    proc sql;
    create table result as 
    select <what ever you want>
    from first_table as t1, second_table as t2
    where t2.name = compress(t1.name ||'H');
    quit;
    

    【讨论】:

    • 正如我所想的那样:||t1.name(包括其训练空白)与"H"compress 删除那些空白
    猜你喜欢
    • 2014-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-10
    • 1970-01-01
    • 2021-06-14
    • 1970-01-01
    相关资源
    最近更新 更多