Announcement

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

  • Difficulty exporting summary stats to Latex

    The summary table in stata outputs with the industry names along the top as columns and the mean sd min max count as rows. I would like to export the table like this to Latex, but am struggling to do so currently. If I add c(stat) to the tabstat it solves the problem and exports to Latex, but then mean sd min max count are the columns, which I don't want. Please help! I have attached my data. Thank you in advance.

    Code:
    eststo clear
    // Look at industry returns
    estpost tabstat market nodur durbl manuf enrgy hitec telcm shops hlth utils other if ScheduledMeeting == ., statistics(mean sd min max count)
    
    ***Now, Output with Specific Decimal Places
    #delimit ;
    esttab using outtex.tex,
     replace ///Replace file if already exists
     cells("mean(fmt(2)) sd(fmt(2)) min(fmt(2)) max(fmt(2)) count(fmt(0))") ///Which Stats to Output
     nonumber ///Do not put numbers below column titlles
     nomtitle ///This option mainly for regression tables
     booktabs ///Top, Mid, Bottom Rule
     noobs ///We don't need observation counts because count is N
     title("Industry Returns on Non-Meeting Days\label{tab1}") ///Latex number this for us
     collabels("Mean" "SD" "Min" "Max" "N") /// Name of each column
    ;
    
    eststo clear


    If possible, I would include the following summary tables as well (without the industry names at the top, so only the mean sd min max count). For the section of the table where ScheduledMeeting == ., I would like a label on the left-hand side stating "Non-Meeting Days", for ScheduledMeeting == 1 "Meeting Days", and ScheduledMeeting == 0 "Intermeeting Days". Thank you!

    Code:
    tabstat market nodur durbl manuf enrgy hitec telcm shops hlth utils other if ScheduledMeeting == 1, statistics(count mean sd min max)
    tabstat market nodur durbl manuf enrgy hitec telcm shops hlth utils other if ScheduledMeeting == 0, statistics(count mean sd min max)


    Though less important, if someone could also help me figure out the code to export the following table to Latex, that would be great.

    [/CODE]
    tabstat Change Surprise new_Surprise Expected new_Expected if ScheduledMeeting == 1, by(ChangeDirection) stats(mean sd count) columns(variables)
    [/CODE]
    Attached Files
    Last edited by Ezra Pol; 29 Mar 2024, 16:18.

  • #2
    Anyone able to help out with this thread?

    Comment


    • #3
      Perhaps if you post a reproducible example illustrating your question you will have more success.
      Devra Golbe
      Professor Emerita, Dept. of Economics
      Hunter College, CUNY

      Comment


      • #4
        Here is the example illustrating what/how I would like to export from stata to Latex:

        Click image for larger version

Name:	Screenshot 2024-04-06 at 12.23.08 PM.png
Views:	2
Size:	330.9 KB
ID:	1749114



        Here is the second table I would like to export, in the same structure in terms of rows and columns:
        Click image for larger version

Name:	Screenshot 2024-04-06 at 12.25.52 PM.png
Views:	1
Size:	332.1 KB
ID:	1749115


        Thank you in advance!

        Attached Files

        Comment


        • #5
          Sorry: that's not what I meant. Most listers are not going to download your data. I suggest you frame your question using one of Stata's publicly available datasets so that others can reproduce your steps.
          Devra Golbe
          Professor Emerita, Dept. of Economics
          Hunter College, CUNY

          Comment

          Working...
          X