Bookmark and Share

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

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

Re: st: Conversion from string to numeric with imported excel document

From   Ryan Stevens <>
Subject   Re: st: Conversion from string to numeric with imported excel document
Date   Wed, 3 Oct 2012 09:44:34 -0400

Thank you Hans and Nick for the advice. I fixed the error by just
resaving the excel document as a csv and importing it using insheet.
The error itself was not dealing with precision. If you were looking
at the number presented in a cell it would say 20, however, if you
click on that cell and then look at the true value stated in the bar
at the top, it would say 4. And this would occur for all values. I had
just never seen this happen before. My inkling is maybe there is
something going on with how our online program saves and converts the
data into excel. Anyways, thanks again!


On Wed, Oct 3, 2012 at 8:01 AM, Nick Cox <> wrote:
> The FAQ
> FAQ     . . . . . . . . Converting other format files into Stata dataset files
>         . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
>         8/06    How do I get information from Excel into Stata?
>                 converting-excel-files/
> predates -import excel- but it does flag many small issues.
> In my experience many Stata users expect Stata to understand all sorts
> of conventions that (a) make sense to Excel (b) make sense to Excel
> users because they are familiar as their own personal conventions.
> That can be a tough call, especially (b)
> By the way, the FAQ above was not compiled because I am any kind of
> expert on Excel, or even a competent user. Rather, as a keen Stata
> user I was asked all sorts of questions locally, and I compiled what I
> could glean, some of it from Statalist postings.
> Nick
> On Wed, Oct 3, 2012 at 12:34 PM, Hans Lundin <> wrote:
>> I扉e also had numerous issues with conversion of Excel-sheets containing
>> string variables. If you have to import Excel-sheets more than occasionally,
>> my suggestion is to get the program StatTransfer. You can then decide the
>> storage format for each variable before the conversion. That has solved most
>> conversion problems for me.
>> Best regards Hans Lundin
>> 2012/10/3 Ryan Stevens <>
>>> Hello all,
>>> I'm having a very weird problem. I have imported an excel document
>>> which was generated from an online game me and my co-author are
>>> working with. Of course, when importing it into STATA the numeric
>>> values are stored as strings. However, in trying to convert from
>>> strings to numerics, it changes the values of the cells. I have tried
>>> both encode and destring commands. I also attempted to trim off any
>>> blank spaces, believing this may be an issue. Furthermore, I've tried
>>> manually removing any blank spaces or non-numeric values from the
>>> excel file and re-importing the document, and I still have the same
>>> problem. The odd thing is if I am looking at any given cell it will be
>>> the right value, however, when I click on the cell and view the value
>>> of the number at the top, it does not match what is showing in the
>>> specific cell. Any thoughts on how to resolve this problem would be
>>> greatly appreciated.
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

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