rashmi

2009-03-19 05:56:08 UTC

Permalink

I am trying to cap the values for some data which have outliers to theRaw Message

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?