2

既存の識別子からより単純な一意の識別子を作成しようとしています。ちょうど ID 列から始めて、新しい、より単純な id 列を作成して、最終的なデータが次のようになるようにします。100 万 + id があるので、それは do のオプションではありません。

ID NEWid

1234 1

3456 2

1234 1

6789 3

1234 1

4

2 に答える 2

2

using proc sql.. (you can probably do this without the intermediate datasets using subqueries, but sometimes monotonic doesn't act the way you'd think in a subquery)

proc sql noprint;

    create table uniq_id as
    select distinct id
    from original
    order by id
    ;

    create table uniq_id2 as
    select id, monotonic() as newid
    from uniq_id
    ;

    create table final as
    select a.id, b.newid
    from original_set a, uniq_id2 b
    where a.id = b.id
    ;

quit;
于 2013-08-12T15:00:45.623 に答える