Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Excel import - 3 data columns appearing as string.....

    EDIT: I found the problem. I had 4 cells with ".." in them....... i blanked them out and it worked. Sorted.


    I have a dataset here:
    DELETED - PROBLEM SOLVED

    when i load it into stata, 3 of the data columns, data2005-data2008 are coming up as string variables, even though the rest of the columns are not.
    All columns have come from the same data sources.......

    i cannot understand why.
    I've tried copying the data into a different excel file, i've tried changing 'text to columns' in excel, but no success.

    i just don't get it, this data is from the same sources i've got other data from, and i've been using that dataset in stata with no issue.
    any ideas?





    Last edited by mo richi; 23 Aug 2017, 19:08.

  • #2
    If Stata imports a column as a string variable rather than numeric, that means the column must contain some value that cannot be interpreted as a number. Here's how I found one such example.
    Code:
    . tab data2005
    
              data2005 |      Freq.     Percent        Cum.
    -------------------+-----------------------------------
    -.0099083853533924 |          1        0.04        0.04
    -.0130029481058316 |          1        0.04        0.08
     -.056414197038446 |          1        0.04        0.13
    -.0926233089815177 |          1        0.04        0.17
     -15.8416948621915 |          1        0.04        0.21
     -25.2242438200254 |          1        0.04        0.25
                    .. |          3        0.13        0.38
     .0001508106031052 |          1        0.04        0.42
     .0002369679477154 |          1        0.04        0.46
     .0006533214832723 |          1        0.04        0.50
     .0013199647305424 |          1        0.04        0.55
       .00136979865848 |          1        0.04        0.59
    --Break--
    r(1);
    You need to correct these values of ".." in your spreadsheet for Stata to import the values as numeric.

    Comment


    • #3
      Other such threads can be found with a search. One such is https://www.statalist.org/forums/for...iable-problems -- which includes code for a diagnostic program.

      Comment

      Working...
      X