Announcement

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

  • Major problem importing Excel file

    Dear all,
    I have a major problem importing data from an excel sheet into Stata - specifically I get the r(198) error, which is not particularly helpful.

    The following command is being used:
    Code:
    import excel using siena.xls, firstrow sheet(Vorstand) cellrange(A1:EW1086)
    Here's the thing: I tried this exact code on an excel sheet that has the exact same structure, but less columns and rows (only about 10 each). It imports flawlessly. When I try to import it via "Import - Excel spreadsheet" and select "first row as variables" it gives me the same error, but when I click "import all data as strings" it imports the data without question. However, the rest of my code does not work like this as it expects the data to be formatted as "date/time" and I don't see why Stata wouldn't just import the file as it is. What's even more curious: If I do not use the firstrow command it imports data.

    It seems to me that either Stata can't handle the file size (unlikely - it's about 3MB) or there is something wrong with the Excel sheet. Unfortunately I have no idea what that could be as the format is exactly the same in my test sheet (which worked).

    Any ideas on how to solve this?

    Thank you so much in advance - I've got an important meeting next week and thought I was on the safe side trying the code with a smaller subset of my data. Major mistake as it turns out.

    edit: This might be important - I'm using Stata SE 12.
    Last edited by Steffen Triebel; 03 Nov 2019, 04:30.

  • #2
    SOLVED: one column had no entries except for its first row (the variable name). Stata did not like this.

    However, I'm now running into the issue that it's importing all my date columns as str-type data when it should be integer. I understand that this is because the majority of columns are empty (e.g. there is a date/time-value every 60 rows or so). Is there any way to make Stata ignore the empty columns?

    I've read https://www.stata.com/support/faqs/d...el-files/#nnch and did not find a solution.

    Comment

    Working...
    X