Search code examples
rstatamissing-data

Read Stata with missing codes


I received a .dta file and they have funny missing codes such as: .mm and .x If I read .dta file in R then all of these funny missing codes go to 'NA' and

I am wondering how do I keep them as .mm and .x for example?


Solution

  • Stata allows you to code missing values from ".a" to ".z". It could be useful if the values are missing for different reasons etc. But they are missing nonetheless.

    A quick work-around is to import the data as strings, and create a missing_flag variable to preserve the missing code information.