Transforming data under simple conditions

For questions and discussion related to reading in and working with data.
oli4
Posts: 3
Joined: Thu Aug 07, 2014 8:36 am

Transforming data under simple conditions

Unread post 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
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Transforming data under simple conditions

Unread post 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))
Post Reply