Announcement

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

  • Export to excel from Stata - how to overcome error 198 (when there are no observations)

    Hello everybody!

    I am kindly asking you some help inherent the extraction of a dataset from stata to excel.

    I have a panel data and to extract it from Stata to excel I use this command:

    export excel "NAME_OF_EXCEL_FILE", firstrow(varlabels) sheet("NAME_OF_EXCEL_SPREADSHEET") sheetreplace

    And this works well.

    The problem is that sometimes I have to select only specific variables (using the command "keep"), and in doing this all the observations disappears. But this is correct and I want to extract this new dataset (containing only varlables and no observations) into an excel file.

    The problem is that when I run the command above, I encounted the r198 saying "too many or no observations specified".

    Is there a way to export the dataset to excel? (in this way it would be only an ampty dataset with just varlabels and no observations)

    I guess I have to write additional conditions but I can't find a solution..

    Many thanks!

    Kodi

  • #2
    I wonder whether this previous thread would be helpful to you: https://www.statalist.org/forums/for...el-or-csv-file
    Best regards,

    Marcos

    Comment


    • #3
      Hi Marcos!

      Thank you very much, this was very useful and it solved my problem. Apologies, I had not noticed that thread!

      Many thanks!

      Wish you a great day!

      Kodi

      Comment


      • #4
        Hello Kodi, thank you for the feed back and for informing you consider the thread reached a satisfactory closure.
        Best regards,

        Marcos

        Comment

        Working...
        X