- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
I'm working on some pilot data and naturally I have a non-normal distribution for my outcome. I tried to alleviate this by converting my outcome (continuous) variable to a log base 10 variable. Unfortunately, one of my outcome variables is 0 so SAS gives me the "NOTE: Invalid argument to function LOG10 at line nnn column nn" error message and then treats that variable as missing. Is there a way to solve this?
I made the new variable in a "set" statement so the ?? modifier doesn't seem to work.
Any advice would be much appreciated (I'm a freshie, go easy on me)!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Well, its true, you can't take the log of 0.
One simple way is to add 0.1 to the 0, if that's valid.
Depending on the data there may be other transformations or methods that are available.
data want;
set have;
if pilot=0 then pilot2=0.1;
logpilot=log10(pilot2);
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Reeza jan, I didn't realize a few hours ago that this was a conventional way of solving the problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Logarithmic transformation would make sense for your data if zero values actually mean that the value was too small to be measured. In that case, many analysts will replace zeros with half the smallest value that can be measured, before taking the logarithm.
Taking logarithms is only one of many ways to deal with non-normal data. We would need to know more about the nature of your data to suggest other methods.
PG
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In my case zero just means that the value was actually zero. Values that were too small to be measured were treated as missing data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
sara.a wrote:
Values that were too small to be measured were treated as missing data.
That amounts to left censoring. Wouldn't that automatically create an upward bias in your location (mean, median, etc.) estimates?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I can see how it could cause that...but I'm not sure what else to do. Because for those observations not enough biological sample was obtained for a proper measurement to be taken.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Are you trying to do some Regression ? Check Box transformation
OR use proc tranreg which is designed for such purpose .
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here are a few articles that discuss the problem you mention and suggest a few potential work-arounds:
http://blogs.sas.com/content/iml/2014/07/09/scatter-plots-with-log-axes.html