Monday, January 21, 2013

SAS: log1px funtion

Here's some SAS information I found curious.  I am currently taking a time series course, and in the first homework assignment we are asked to calculate the log returns as lnreturn = log(ret + 1).  This must be a common operation, because SAS has a builtin function for that purpose.  The function is log1px and is used as follows:  lnreturn = log1px(ret);

Big deal, right?  I mean it's not as if the other way (log(ret + 1)) is hard to code.  Yes, but according to the documentation (http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003121132.htm), "when x is close to 0, LOG1PX(x) can be more accurate than LOG(1+x)."

(I assume the 1PX stands for "1 plus x".)


No comments:

Post a Comment