I am using Stata 13 to estimate a simple regression. Given a rather positive skew of a few of my covariates, I figured to ln-transform the variables. However, I have a substantial amount of zeroes in the covariates. Ln-transforming the variables thus leads to many missings.

I came across several ways of handling the issue:

  1. Replacing zeroes to a small value (e.g. 0.00000001)
  2. Nottreating the issue
  3. Dummying the zeroes in a new variable

I do not like option 1 and 2. Replacing feels somewhat random and just wrong. Not treating the issue results in missing information. I thus prefer option 3. But it does not seem to work for me so far. Here is an example of what I do.

clear matrix
set more off

sysuse nlsw88

hist tenure

gen ln_tenure=ln(tenure)

gen null_tenure = 1 if ln_tenure==. & tenure!=.

reg wage grade tenure south
reg wage grade ln_tenure south

reg wage grade ln_tenure null_tenure south

The nlsw88 example dataset provides us with 51 observation with tenure=0. Simply regressing wage on grade with tenure is hence based on 51 more observations compared to regressing wage on grade and ln_tenure.

To not miss out on the information at tenure=0, I created the dummy null_tenure=1 for all tenure=0. Obviously, null_tenure gets omitted when introducing it to the regression.

I have two questions:

  1. Does this way of handling missings created by ln-transforming data make sense?
  2. If so, How can I circumvent the dummy to be omitted ?


  • 1
    $\begingroup$ One common fallacy should be mentioned straight away. Using extremely small positive constants rather than zero, rather than being a very conservative change to the data, is a drastic change to the data. This is marginally easier to see with logs base 10: a constant $10^{-6}$ becomes $-6$ on log 10 scale, one $10^{-9}$ becomes $-9$ on log scale; in short, the smaller the constant, the bigger the negative outliers created and on log scale too! $\endgroup$
    – Nick Cox
    May 26, 2015 at 9:25
  • $\begingroup$ Exactly! Merely replacing is not an option (allthough it seems to be regularly done). $\endgroup$
    – Rachel
    May 26, 2015 at 9:27
  • $\begingroup$ My point was that this particular replacement is unsound, but as the cited thread indicates there are other replacements that preserve information. $\endgroup$
    – Nick Cox
    May 26, 2015 at 9:28
  • $\begingroup$ @NickCox, thanks for the thread which if course is very close to what I am asking. In fact, it answers question (1) of this thread. Answering the more technical question (2) however remains troublesome for me. whuber suggested to generate a second variable that takes the value 1 if the ln-transformed variable was initally zero (see here stats.stackexchange.com/a/1795/77419) - but how can I prevent the dummy variable of being omitted? $\endgroup$
    – Rachel
    May 26, 2015 at 9:49
  • $\begingroup$ 1 if initially zero and 0 otherwise: what's the problem? $\endgroup$
    – Nick Cox
    May 26, 2015 at 10:00