BookmarkSubscribeRSS Feed
sara_a
Calcite | Level 5

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)!

8 REPLIES 8
Reeza
Super User

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;

sara_a
Calcite | Level 5

Thanks Reeza jan, I didn't realize a few hours ago that this was a conventional way of solving the problem Smiley Happy

PGStats
Opal | Level 21

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

PG
sara_a
Calcite | Level 5

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.

PGStats
Opal | Level 21

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?

PG
sara_a
Calcite | Level 5

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.

Ksharp
Super User

Are you trying to do some  Regression ? Check Box transformation

OR use proc tranreg which is designed for such purpose .

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 1859 views
  • 9 likes
  • 5 in conversation