libname loan “D:\2019XYT”;
    data loan.credit;
    set loan.credit_mini;
    run;

    /���������ظ��۲�id/
    / %ExtUnique /

    %macro ExtUnique(dsin,idvar,dsout,dsdup);
    /extract the id’s only to speed calculations/
    data temp_allids;
    set &dsin;
    keep &idvar;
    run;

    proc sql noprint;
    create table temp_uid as select &idvar,count(&idvar) as _count from temp_allids
    group by &idvar;
    run;
    quit;

    data temp_nid;
    set temp_uid;
    if _count>1 then output;
    keep &idvar;
    run;

    proc sort data=&dsin;
    by &idvar;
    run;

    data &dsout;
    set &dsin;
    by &idvar;
    if first.&idvar;
    run;

    proc sql;
    create table &dsdup as select b.* from temp_nid a,&dsin b
    where a.&idvar=b.&idvar;
    run;
    quit;

    proc datasets nodetails nolist;
    delete temp_allids temp_uid temp_nid;
    run;
    quit;
    %mend;

    /dsdinΪ�����������idvarΪid������dsoutΪ������ͬid��������ݼ���dsdupΪ�����ظ�id��������ݼ�/
    %let idvar=cust_id;
    %let dsin=loan.credit;
    %let dsout=credit_id;
    %let dsdup=duplicate_id;
    %extunique(&dsin,&idvar,&dsout,&dsdup);

    proc sql;
    title “�ظ��۲������”;
    select * from &dsdup;
    quit;

    />>>>>>>>>>>>>>>>>>>>>����<<<<<<<<<<<<<<<<<<<<<<
    ���ݼ�loan.creditû���ظ��Ĺ۲⣬ÿһ��id����Ψһ��
    /