/���ݾ���ʶ�𼫶�ֵ/
    /�õ����б��������ԣ�����type=1��ʾ��ֵ�����ݣ�type=2��ʾ�ַ�������/
    /ȥ����ǰ���õ��������쳣�����ı���
    data loan.credit_finall_julei;
    set loan.credit_finall_4;
    drop v_7 v_13 v_15 v_17;
    run;
    ����û��Ҫ
    /

    proc contents data=loan.credit_range(drop=v_1 v_5)
    noprint out=ccc;
    run;

    /ȡ��������ֵ�ͱ�������/

    proc sql noprint;
    select NAME,count(*)into:mm1_num_var_bk1 separated by ‘ ‘,:mm1_num_var_bk1_cnt
    from ccc
    where type=1
    ;
    quit;
    %put &mm1_num_var_bk1.;

    %macro clustol(dsin,varlist,nclust,pmin,dsout);
    proc fastclus data=&dsin maxc=&nclust maxiter=100
    cluster=clusterindex out=temp_clust noprint;
    var &varlist;
    run;

    proc freq data=tempclust noprint;
    tables _clusterindex
    / out=temp_freqs;
    run;

    data templow;
    set temp_freqs;
    if percent<=&pmin*100;
    _outlier
    =1;
    keep clusterindex outlier;
    run;

    proc sort data=tempclust;
    by _clusterindex
    ;
    run;

    proc sort data=templow;
    by _clusterindex
    ;
    run;

    data &dsout;
    merge tempclust temp_low;
    by _clusterindex
    ;
    drop clusterindex distance;
    if outlier=. then outlier=0;
    run;
    %mend;

    /dsinΪ�������ݼ���varlistΪ�ھ��������ʹ�õı����б���nclustΪ��Ҫ�õ��ص�������pminΪ��ʶΪ����ֵ�Ĵص�����ģ��dsoutΪ��������ֵ��������ݼ�/
    %let dsin=loan.creditrange;
    %let varlist=&mm1_num_var_bk1.
    ;
    %let nclust=200;
    %let pmin=0.05;
    %let dsout=clust_out;
    %clustol(&dsin,&varlist,&nclust,&pmin,&dsout);
    data loan.clust_out;
    set clust_out;
    where _outlier
    =0;/����޳��쳣���ݺ�����ݼ�/
    drop outlier;
    run;