Announcement

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

  • export tabstat to Excel

    Hello everyone !
    I would like to export the summary statistics of my dataset into Excel to make it nicer to paste in my dissertation. The code is:

    -tabstat FinancialLeverage NPLLoans IndepDir InstOwner LS BankSize StockretT1 MarketCap BonusTotalComp Tier1CR BoardSize EmployeesBranch LoansAssets LoanProvisionNPL Help1 Help2 ECBIR AnnGDPGrowth, statistics( mean sd max min ) by(BankName)

    So that I will obtain statistics for the 14 Italian banks I am studying. What should I do next ?

    Thank You,

    Paolo

  • #2
    Have you tried the -putexcel- command? You have to use the -save- option in tabstat such that it leaves stuff behind in -return list-.

    Code:
    sysuse auto
    tabstat price weight mpg rep78, by(foreign) stat(mean sd min max) save
    return list

    Comment


    • #3
      Dear Dave,
      Thank you for getting back to me.
      I tried putexcel command, but keeps telling me (when I try set variables):

      putexcel B1 = "Coefficients"
      "Coefficients": expression must be enclosed in ()

      When I use the code you have posted, tabstat and return list are run with no mistake as usual, however when I try link matrices such this:

      matrix desio e brianza = r(Stat14)'
      putexcel A3 = matrix(desio e brianza), rownames nformat(number_d2) (Desio e Brianza is a bank)
      file myresults.xlsx saved


      Keeps telling me it does not recognise the matrices

      Comment


      • #4
        These work for me:

        Code:
        version 14.2
        
        clear
        sysuse auto
        tabstat price weight mpg rep78, by(foreign) stat(mean sd min max) save
        return list
        putexcel set tabstat.xlsx, replace
        putexcel A1 = matrix(r(Stat2)), names
        
        clear
        sysuse auto
        tabstat price weight mpg rep78, by(foreign) stat(mean sd min max) save
        return list
        matrix A = r(Stat2)
        putexcel set tabstat.xlsx, replace
        putexcel A1 = matrix(A), names

        Comment

        Working...
        X