Announcement

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

  • error in importing excel file

    I don't know why I cannot import a specific excel file into Stata. I open it manually and saw that it was a protected file which could not be edited. I change some excel file properties which made it possible editting. However, I tried to import it again into Stata and it still did not work.

    Code:
    file C:\Users\Paula\Pesquisa\DADOS\IBGE\Censo_Setor_Censitario\2010/TO/EXCEL\Pessoa01_TO.xls could not b
    > e loaded
    r(603);

  • #2
    The explanation provided by help rc 603 suggests that perhaps the file was still open in Excel when you tried to open it in Stata. Try again, and for good measure, quit Excel first, even if this file is not open.

    Comment


    • #3
      I had a similar problem while using the user-written command "xls2dta", where I could not import an excel file with two sheets into Stata. I used the same command to load other excel files with multiple sheets and it works. William, just to clarify, the file was not open and I entirely quit excel before moving forward.

      This is the error I recieved:
      Code:
      file H:\LABWIDE\Regional Promise Grant Evaluation\Data\Course list\SOP\SOP_v4.xlsx could not be l
      > oaded
      r(603);

      So, I copied the contents of the excel file into a new excel file, renamed it with a suffix "v5" (earlier file was v4) and tried loading it again. It worked this time:

      Code:
      file H:\LABWIDE\Regional Promise Grant Evaluation\Data\Course list\Stata\SOP\SOP_v5_1.dta saved
      file H:\LABWIDE\Regional Promise Grant Evaluation\Data\Course list\Stata\SOP\SOP_v5_2.dta saved

      This is the code I used both times, only changing the suffix of the filename:
      Code:
          clear
          xls2dta, allsheets gen(filename sheetname) save("$root\Stata\SOP", replace): ///
          import excel using "$root\SOP\SOP_v5.xlsx", firstrow allstring
      This brute force solution works, but I didn't really get at the ultimate cause of the problem. I would appreciate any help. Thank you!
      Last edited by Biraj Bisht; 03 Feb 2016, 17:27.

      Comment


      • #4
        any known solution to this problem?

        Comment


        • #5
          Paula, can be one of a million reasons.

          Excel import is subject to limits, see here:http://www.stata.com/manuals14/dimportexcel.pdf

          Some messages on Statalist refer to other Excel infrastructure that may come in the way:
          http://www.stata.com/statalist/archi.../msg01325.html

          Check if your file can be opened in excel itself, then try to resave, or try to resave into a different format.

          Best, Sergiy

          Comment


          • #6
            save excel file as CSV and then import this CSV format to STATA. I hope it will work.

            Comment

            Working...
            X