[EpiData-list] Missing data values when exporting to Stata

EpiData development and support epidata-list at lists.umanitoba.ca
Thu Aug 22 16:40:02 CDT 2019


Sorry for not giving any information about the versions and system I use.

I use EpiData Manager v4.4.2.1 on a MacBook Pro 13” (2018) running Mojave 10.14.6 to export. The exported files are to Stata v12.
The .dta files are opened in Python v3.6.8 via PyCharm IDE CE 2019.2 and imported to a Panda dataframe with the command “pd.read_stata(<filename>). The empty lines in the Stata-file gets correctly set as “NaN” in Pandas, but the value label for the missing category is set to “100.0” instead of “NaN” as I expect it should be after coding this in EpiData.

Kind Regards
Henning L. Stokmo
Phd-Student, Oslo University Hospital


> On 22 Aug 2019, at 19:00, epidata-list-request at lists.umanitoba.ca wrote:
> 
> Send EpiData-list mailing list submissions to
> 	epidata-list at lists.umanitoba.ca
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://lists.umanitoba.ca/mailman/listinfo/epidata-list
> or, via email, send a message with subject or body 'help' to
> 	epidata-list-request at lists.umanitoba.ca
> 
> You can reach the person managing the list at
> 	epidata-list-owner at lists.umanitoba.ca
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of EpiData-list digest..."
> 
> 
> EpiData-list mailing list
> ___________________________________
> 
> Today's Topics:
> 
>   1. Re: Missing data values when exporting to Stata
>      (EpiData development and support)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Wed, 21 Aug 2019 21:43:41 +0200
> From: EpiData development and support
> 	<epidata-list at lists.umanitoba.ca>
> To: epidata-list at lists.umanitoba.ca
> Subject: Re: [EpiData-list] Missing data values when exporting to
> 	Stata
> Message-ID: <CE3439F1-72F7-4F8A-90F1-313DF876BD64 at epidata.dk>
> Content-Type: text/plain; charset=utf-8
> 
> As I remember the Stata value should be
> .a
> But please specify which version of Stata and if you are using Manager export or the new analysis, which may directly save the file in Stata format.
> 
> Best wishes
> Jens Lauritsen
> EpiData Association
> Denmark 
> 
> Den 21. august 2019 14.04.31 CEST, EpiData development and support <epidata-list at lists.umanitoba.ca> skrev:
>> Hi,
>> 
>> I have some missing data that is encoded as ?9? in the database and in
>> the value label list it is flagged as missing. When exporting to CSV
>> the value is obviously set as ?9? as expected. 
>> 
>> When I export it as Stata I assume this value ?9? gets encoded to
>> Stata? definition of a missing value, but when I read the data in
>> Python with the ?pd.read_stata?-function it defines the category value
>> ?9? as 100.0 and not as missing data (NaN) like the blanks in EpiData.
>> 
>> Eksample
>> One column has 80 values. 19 of these are encoded as ?9? (missing), 58
>> of these are blank, and 3 are coded as ?1? (Yes) in EpiData. After
>> exporting to Stata and reading in Python I get 
>> 
>> 19 values in category ?100?
>> 3 values in category ?Yes?
>> 58 values NaN (i.e. missing)
>> 
>> Why aren?t the ?9? category correctly coded as missing when exporting
>> to Stata, or am I missing something here?
>> 
>> Kind Regards
>> Henning
>> _______________________________________________
>> EpiData-list mailing list
>> EpiData-list at lists.umanitoba.ca
>> http://lists.umanitoba.ca/mailman/listinfo/epidata-list
> 
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
> 
> ------------------------------
> 
> ________________________________________
> EpiData-list at lists.umanitoba.ca
> http://lists.umanitoba.ca/mailman/listinfo/epidata-list
> 
> 
> End of EpiData-list Digest, Vol 183, Issue 2
> ********************************************



More information about the EpiData-list mailing list