# How to deal with invalid data values such as with age (e.g., -99, 0, F1)?

I have a data set that consists of 15 age values.

I want to clean the data before doing anything further. I have a few questions about data cleaning and data integrity.

What is the best treatment if the dataset contains an illegal value (like '${\rm F1}$', e.g.)? I thought taking the mean of the 14 remaining values and doing a mean substitution might be a good idea.

If there are values that cannot be right, such as $-99$ (no one can be $-99$ years old), is the best course of action a subjective treatment? Or should I use a statistical method, such as mean substitution? It seems logical to me to turn the $-99$ to a $+99$, and treat it as a data entry error.

Can $0$ be an age? The data set contains a $0$ value.

I am mostly looking to know if there is any formalised approach to dealing with these type of problems.

-
If it is an illegal value, then it is a data entry error. If you're specifically talking about age and you have reason to believe that the clerk meant to type 99 instead of -99, then it's fine to make that subjective correction if you know you're dealing with elderly subjects. However if the subject in question could be 9 years old because your data set encompasses people of all ages, then you can't do that. To infer the age of subjects is a difficult thing, though. For age you can't do mean substitution. 0 years can be an age if you're talking about newborns. –  rocinante Mar 18 '14 at 1:29
Note that $-99$ is often an automatic value that is used by some software (SPSS, I think) to mark missing data. –  gung Mar 18 '14 at 1:48
As far as I remember, $-99$ is not "automatic", but one can specify values that are to be considered missing in SPSS and $-99$ (and $-98$ if one wants to differentiate between e.g. "don't know" and "don't want to answer") are very conventional candidates for such missing value codes. Alternative common values are be $-999$ and $-998$, depending on the range of the variable in question. This should be documented in the codebook, so there should be no need to guess. In fact, if there is no codebook explaining this, then that is a very bad sign about the quality of the data. –  Maarten Buis Mar 18 '14 at 8:31

• Official missing data values: In some cases, a dataset will have an official set of values to indicate missing data. Common values include -9, -99, -999, NA, 99, etc. In these cases, you need to ensure that the software you use, is aware that such values are missing. In SPSS, there is a field to specify, missing data values. In R you can often specify this when reading data, or you can replace such values with NA.