Announcement

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

  • Import more excel files

    Dear Stata experts,

    I'm new to stata and need some help for my analysis. This is my problem:
    I've 8 excel files and I want to import the files in an only STATA's files. They have all the same variables.
    When I import a single file, after the second, automatically it loads the command "clear".

    I send the results.
    I'm grateful for all the help you can give.

    Click image for larger version

Name:	Immagine.png
Views:	1
Size:	7.0 KB
ID:	1453815
    Click image for larger version

Name:	Immagine2.png
Views:	1
Size:	14.0 KB
ID:	1453816

  • #2
    Hi Stefano,

    Stata works with a single database open at a time. If you want to put the content of these 8 excel files into a single Stata file, look at -append.

    https://www.stata.com/manuals13/dappend.pdf

    You might have to convert all excel files to Stata (.dta) files before appending them. If so, open one excel file (as you did) and save it as a dta file (File -> Save As). Do the same for the 8 files. Open the first dta file and try appending the second file to the first (Data -> Combine datasets -> Append datasets). Repeat procedures to files #3 to #8.

    Best;

    Comment


    • #3
      It is not clear from your post how the datsets fit together and how you want the final Stata dataset to look like. Once you have figured this out, see xls2dta (from SSC) for an automated way of importing more than one Excel file and/or sheet.

      Best
      Daniel

      Comment


      • #4
        Thanks for the help, I try to apply your advice.

        Comment


        • #5
          I’ve done. Thank

          Comment

          Working...
          X