turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- just remove upper and lower1 percentile value

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-06-2012 05:30 AM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to greenhousemilk

12-06-2012 08:59 AM

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;

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to AncaTilea

12-07-2012 05:07 AM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to greenhousemilk

12-10-2012 04:52 AM

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)