Announcement

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

  • Esttab formatting to numbers in excel file

    Hi Statalist,

    I am using esttab from SSC in Stata 16.1 to make summary tables of tab (percents) in excel. In the excel cells, it is fomatting the output as ="". For example, using the sample code below it's outputting Domestic frequency in the excel cell as ="52" (visually appears as 52). Is there some way to have the output be a plain number in excel so the cell shows 52 (without the ="")?

    Thank you!

    sysuse auto

    eststo clear
    estpost tab foreign
    esttab using example.csv, cells("b(label(freq)) pct(fmt(2))") varlabels(, blist(Total)) nonumber noobs replace

  • #2
    Thanks for the reproducible example. Here is a way:

    Code:
    sysuse auto, clear
    eststo clear
    estpost tab foreign
    esttab using example.csv, cells("b(label(freq)) pct(fmt(2))") varlabels(, blist(Total)) nonumber noobs replace
    import delimited example.csv, clear
    foreach var of varlist *{
        replace `var'= ustrregexra(`var', `"[="]"', "")
    }
    export excel using example, replace

    Your wanted file is now example.xls whereas the esttab file is example.csv.

    Comment


    • #3
      That works! Thank you.

      Comment

      Working...
      X