Announcement

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

  • Saving output from Stata into a specific excel sheet

    Hello Everyone,

    I have created a so-called "balance table" using t-tests, and now I want to save it in a specific excel sheet with the "replace" option. I want to save it in a specific excel sheet because, in the same excel file, I have another sheet linked to the sheet from Stata output. To elucidate the case more, I have an excel file called "Balance Tables," which has two sheets - sheet1 and sheet2. I want Stata to save my results in "sheet1" every time I run my do-file, and I don't want Stata to entirely replace the excel file since I will lose "sheet2". I would highly appreciate your advice on this question.

    P.S. I am not sure if sharing any data, code, or file is necessary, but please let me know if it can be useful.

    Thank you,
    Nick

  • #2
    If you are using the export excel command to save your "balance table" then the option
    Code:
    ... sheet("sheet1", replace) ...
    will replace sheet1 leaving sheet2 unchanged.

    Comment


    • #3
      Originally posted by William Lisowski View Post
      If you are using the export excel command to save your "balance table" then the option
      Code:
      ... sheet("sheet1", replace) ...
      will replace sheet1 leaving sheet2 unchanged.
      Dear William,

      Thank you very much for your reply. I am actually using another command with browse save - "browse save("$output\Balance_Table_Output")". I am not sure if it posiible to save into a specific sheet with this command.

      Comment


      • #4
        The output of
        Code:
        help browse
        does not document a
        Code:
        browse save()
        command. Perhaps you are describing actions using Stata menus? But in any event the Stata save command cannot create, replace, or update Excel workbooks.

        See
        Code:
        help export excel
        or from Stata's File menu choose Export > Data to Excel spreadsheet (.xls, .xlsx).

        Comment

        Working...
        X