/ʶ�𼫶�ֵ/
    /���ݷ�Χʶ�𼫶�ֵ/

    proc contents data=loan.credit_1 out=dis noprint;run;
    proc sql noprint;
    select name into:numlist separated by ‘ ‘ from dis
    where type=1;
    quit;

    /��ͨ�����������ķ�Χ��ɸѡ/
    /���Ƕ�v_7 �����˻������ �Ѽ���ֵ���޳�/
    %macro extremes(dsin,varx,idvar,nsigmas,dsout);
    data temp;
    set &dsin;

    run;

    proc univariate data=temp noprint;
    var &varx;
    output out=temp_u std=vstd mean=vmean;
    run;

    data null;
    set temp_u;
    call symput(‘std’,vstd);
    call symput(‘mean’,vmean);
    run;
    %let ulimit=%sysevalf(&mean+&nsigmas&std);
    %let llimit=%sysevalf(&mean-&nsigmas
    &std);

    data &dsout;
    set temp;
    if &varx<&llimit or &varx>&ulimit then outlier=1;
    else outlier=0;
    run;

    proc datasets library=work nodetails nolist;
    delete temp temp_u;
    quit;
    run;
    %mend;

    /*dsinΪ�������ݼ���varxΪ���м���ֵ�����ı�����idvarΪid������nsigmasΪʹ�ñ�׼���������dsoutΪ��������ֵ��������ݼ�
    %let dsin=loan.credit_finall;
    %let varx=v_7;
    %let idvar=v_1;
    %let nsigmas=3;
    %let dsout=yout1;
    %extremes(&dsin,&varx,&idvar,&nsigmas,&dsout);

    /*�����ݼ�creditfinall���޳��쳣����
    data loan.credit_finall_1;
    set yout1;
    if _outlier
    =1 then delete;
    run;

    /���Ŷ�v_13��������/
    /*dsinΪ�������ݼ���varxΪ���м���ֵ�����ı�����idvarΪid������nsigmasΪʹ�ñ�׼���������dsoutΪ��������ֵ��������ݼ�
    %let dsin=loan.credit_finall_1;
    %let varx=v_7;
    %let idvar=v_13;
    %let nsigmas=3;
    %let dsout=yout2;
    %extremes(&dsin,&varx,&idvar,&nsigmas,&dsout);

    /*�����ݼ�creditfinall���޳��쳣����
    data loan.credit_finall_2;
    set yout2;
    if _outlier
    =1 then delete;
    run;

    /*dsinΪ�������ݼ���varxΪ���м���ֵ�����ı�����idvarΪid������nsigmasΪʹ�ñ�׼���������dsoutΪ��������ֵ��������ݼ�
    %let dsin=loan.credit_finall_2;
    %let varx=v_7;
    %let idvar=v_1;
    %let nsigmas=3;
    %let dsout=yout3;
    %extremes(&dsin,&varx,&idvar,&nsigmas,&dsout);

    /*�����ݼ�creditfinall���޳��쳣����
    data loan.credit_finall_3;
    set yout3;
    if _outlier
    =1 then delete;
    run;

    /��һ�������޳�����д����/
    /�õ����б��������ԣ�����type=1��ʾ��ֵ�����ݣ�type=2��ʾ�ַ�������/
    proc contents data=loan.credit_1(drop=v_1 v_5)
    noprint out=origin_dev_variable;
    run;

    /ȡ��������ֵ�ͱ�������/
    data origin_num_var;
    set origin_dev_variable;
    where type=1;
    keep name;
    run;
    proc sql noprint;
    select count(*) into :n from origin_num_var;
    quit;
    data credit1;
    set loan.credit_1;
    run;

    %macro vartc(i);

    %let dsid=%sysfunc(open(originnum_var));
    %if &dsid gt 0 %then %do;
    %let nobs=%sysfunc(attrn(&dsid,nobs));
    %do i=1 %to &nobs;
    %let rc=%sysfunc(fetchobs(&dsid,&i));
    %let varnume=%sysfunc(varnum(&dsid,name));
    %let variable=%sysfunc(getvarc(&dsid,&varnume)); /
    ��������variable�ij��� _/

    %let dsin=credit&i;
    %let varx=&variable;
    %let idvar=v_1;
    %let nsigmas=3;
    %let dsout=yout&i.;
    %extremes(&dsin,&varx,&idvar,&nsigmas,&dsout);

    /д�ĺ����� �����ݼ�credit_1���޳��쳣����/
    %let n=%eval(&i.+1);
    data credit&n.;
    set yout&i.;
    if outlier=1 then delete;
    run;

    1. %end;
    2. %let dsid=%sysfunc(close(&dsid));
    3. %end;

    %mend vartc(&i);
    /����1��2��3��ָÿ���޳��󴴽������ݼ� 7��13��17��Щ��ָ�����ı���v_7 v_13 v_17/

    %vartc(&n);

    /���еõ�credit71 ������ݼ� �������ȫ���޳���/
    data loan.creditrange;
    set credit71(drop=_outlier
    );
    run;