Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: Strings dropped when importing Excel file


From   Joe Canner <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: RE: Strings dropped when importing Excel file
Date   Fri, 8 Nov 2013 19:21:58 +0000

Glad to help.  It's worth noting that #N/A is the official Excel missing value code.  If you type #N/A directly into a spreadsheet (which is what I did to reproduce your problem) it will be interpreted as a missing value code, not as a valid text string. Hence the need for the single quote.  It would be nice if one could turn off this behavior in Excel.


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Friedrich Huebler
Sent: Friday, November 08, 2013 2:18 PM
To: [email protected]
Subject: Re: st: RE: Strings dropped when importing Excel file

Thank you, Joe. This works. Stata now imports #N/A as "#N/A (same for #DIV/0! and #VALUE!) and no information is lost.

Friedrich

On Fri, Nov 8, 2013 at 1:56 PM, Joe Canner <[email protected]> wrote:
> Freidrich,
>
> -import excel- is fairly clever at figuring out the correct type and format of Excel spreadsheet variables, including, apparently, error/missing codes.  The only solution I can think of is to add a single quote before the "#N/A" and "#VALUES!".  This will trick Excel and Stata into thinking these are truly strings and not special codes.
>
> Regards,
> Joe Canner
> Johns Hopkins University School of Medicine
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Friedrich 
> Huebler
> Sent: Friday, November 08, 2013 1:24 PM
> To: [email protected]
> Subject: st: Strings dropped when importing Excel file
>
> I use Stata 12.1. When importing an Excel file with string variables (cell format "Text"), the variables are correctly imported as strings but the following entries are replaced by empty cells in Stata:
>
> #N/A
> #VALUE!
>
> Is it possible to keep these strings? I found no information on this in the documentation for -import excel-. The -allstring- option makes no difference.
>
> Thanks,
>
> Friedrich

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index