Announcement

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

  • Extra rows, error while using import delimited or insheet command

    Dear statalisters,
    I have occasionally observed that when I try to import data into stata from *.csv files using insheet or import delimited command then : Stata somehow creates extra empty rows at the end of the dataset (consistent error but only with some files). I have always wondered whether others have observed this behaviour at times and what is the reason for the error. I can get rid of the empty rows easily but then I am concerned about the data validity of the rest of the dataset.
    Thanks in advance for your thoughts.
    Kind regards,
    Ram

  • #2
    I have seen this with data imported from MS Excel and it appears to be a result of how Excel works in responding to user interaction. But there's no sense in which I am an expert on MS Excel. My main impulse when using it is to get out as fast as possible and back to Stata.

    missings from the Stata Journal includes a subcommand missings dropobs to drop empty observations.

    SJ-17-3 dm0085_1 . . . . . . . . . . . . . . . . Software update for missings
    (help missings if installed) . . . . . . . . . . . . . . . N. J. Cox
    Q3/17 SJ 17(3):779
    identify() and sort options have been added

    SJ-15-4 dm0085 Speaking Stata: A set of utilities for managing missing values
    (help missings if installed) . . . . . . . . . . . . . . . N. J. Cox
    Q4/15 SJ 15(4):1174--1185
    provides command, missings, as a replacement for, and extension
    of, previous commands nmissing and dropmiss

    Comment


    • #3
      Dear Nick,
      Thanks a lot and appreciate your input.
      Kind regards
      Ram

      Comment


      • #4
        I have always wondered whether others have observed this behaviour at times
        Since you wish to know it, yes, that happened to me several times.

        Interesting enough, I think it never happened when I used my (authorized) Excel's sheet from the beginning to the end of the collection of data.

        But it ocurred when several (usually, students of mine) persons shared the same sheet, hence one tends to think it might be due to (mis) use of Excel, conflict between computers, etc.

        That being said, my "solution" has ever since been, well, unrefined, for I create a provisory id-variable, then I - drop - if id > #.

        Interesting enough, this phenomenon sometimes happens not only by adding missing observations, but also by adding extra columns with missing values.

        Thank you for having underscored this tricky aspect.
        Last edited by Marcos Almeida; 10 Jun 2018, 09:08.
        Best regards,

        Marcos

        Comment

        Working...
        X