Date: Thu, 19 Mar 2009 08:15:42 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: capping outliers
If you're only trying to cap at the 80th percentile, then wouldn't the
following modification of your last data step do what you want?:
data expt ;
set expt;
if(_n_ eq 1) then set out;
var_est = min(var,var80);
run;
HTH,
Art
-------
On Wed, 18 Mar 2009 22:56:08 -0700, rashmi <kkrashmi@GMAIL.COM> wrote:
>I am trying to cap the values for some data which have outliers to the
>minimum of variable value or 1 times the 80th percentile of the
>variable(var80).The file has variables varstd, which is the standard
>deviation of the variable (var), the 80th percentile (var80) and the
>original variable (var)
>The code that I have written is
>
>data expt;
>input var@@;
>datalines;
>57 82 31 65 25 212
>42 35 55 50 25 55
>54 43 187 567 987
>12 0 91 76 65 657
>527 879 907 73 53
>94 27 1225 25 765
>1980
>;
>run;
>
>proc univariate data=expt plot;
>var var;
>run;
>
>proc univariate data=expt noprint;
>var var;
>output out=out std=varstd
>pctlpts=80
>pctlpre=var;run;
>
>data expt ;
>set expt;
>if(_n_ eq 1) then set out;
> if varstd > 2*var80 then
> var_est = min(var,(1*var80));
>else var_est = var;
>run;
>
>proc univariate data=expt plot;
>var var;
>run;
>
>But, this does not seem to work.
>Could any one help me?
|