Page 1 of 1

Transforming data under simple conditions

Posted: Fri Aug 15, 2014 12:22 pm
by oli4
Hi All

I have a pretty basic question. Having used an estimated co variance matrix to calculate optimal weight ratios I now need to transform this data under three simple conditions. If weight is

between 0 and 1 leave it,
below 0 set to 0 and
above 1 set to 1

Does anyone have the simple coding for this?

Regards

Oil

Re: Transforming data under simple conditions

Posted: Fri Aug 15, 2014 1:24 pm
by TomDoan
The simplest is

set weight = %max(%min(weight,1.0),0.0)

Alternatively

set weight = %if(weight<=0.0,0.0,%if(weight>=1.0,1.0,weight))