Page 1 of 1

Log transformation

Posted: Wed Apr 08, 2015 4:33 am
by mranpara03
I want to transform a series of total medical costs totmed by taking the natural log. However some values are zero so when I try to do this using generate it gives me an error saying some values are non positive. Is there a way that I can do this log(totmed); = 0 if totmed < 1 so that the non positives are zero in the new series and the rest are transformed?

Re: Log transformation

Posted: Wed Apr 08, 2015 6:13 am
by startz

Code: Select all

series newSeries = @recode(totmed<1,0,log(totmed))