just remove upper and lower1 percentile value

Reply
Occasional Contributor
Posts: 8

just remove upper and lower1 percentile value

Hello;

I want to remove upper 1 percentile and lower 1 percentile value and I use following procedure. I want to use output for next round of calculation. I usually do like this.

data a;

proc univariate;

var mcm fmcm;

/*

...................

99 % mcm=23

1% mcm =3

99% fmcm=29

1% mcm =6

.........................

*/

if mcm >23 then delete;

if fmcm <3 then delete;

It is quite cumbersome, if someone help me to more efficient and automated process that I can directly use output of 98% data (after removing top and bottom 1 percentile).

Thanx

Super Contributor
Posts: 543

Re: just remove upper and lower1 percentile value

Hi.

How about this?

data have;

    do i = 1 to 20 by 2;

        x = i;output;

    end;

run;

*save a SAS data set with the percentiles;

proc univariate data = have;

var x;

ods output Quantiles = temp;

run;

*create two macros variables to save the numeric value of 1%tile and 99%tile;

data _null_;

    set temp;

        if Quantile = "99%" then call symput ("_99pct", estimate);

        if Quantile = "1%" then call symput ("_1pct", estimate);

run;

*check that it works;

%put &_1pct. &_99pct.;

*restrict to 98% of data;

data want;

    set have;

    if  &_1pct < x < &_99pct. ;

run;

Occasional Contributor
Posts: 8

Re: just remove upper and lower1 percentile value

Thanks, It worked perfectly when I have one variable but generally I have 10 to 15 variable at same time and I was unable to extend it.

Occasional Contributor
Posts: 15

Re: just remove upper and lower1 percentile value

So what do you want to get? There is no straightforward way to have percentiles on multivariate data. You could apply the percentile exclusion on each of your 10-15 variables simultaneously, but then you will exclude up to 20-30 % of the data (in case a data record in an upper or lower tail is in that tail for no more than one single variable)

Ask a Question
Discussion stats
  • 3 replies
  • 2221 views
  • 6 likes
  • 3 in conversation