Announcement

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

  • Exporting the collapsed dataset into tex file

    Hello! I am trying to export the dataset after collapsing. My code is as follows : collapse (mean) pop mort surv, by(countryname). I am not sure how to export the collapsed table into a tex file. Any help regarding that will be highly appreciated.

  • #2
    I don't know if this will give you exactly the layout you are looking for, but you could do something like this:
    Code:
    sysuse auto, clear
    
    collapse (mean) mpg price headroom, by(rep78)
    foreach v of varlist _all {
        local lbl: var label `v'
        local lbl: subinstr local lbl "(mean) " ""
        label var `v' `"`lbl'"'
    }
    
    table (rep78) (var), statistic(mean mpg price headroom) nototals
    
    collect export my_file.tex, replace

    Comment


    • #3
      Also see

      Code:
      ssc desc texsave

      Code:
      collapse (mean) pop mort surv, by(countryname)
      texsave * using myfile.tex, replace
      Last edited by Andrew Musau; 27 Jan 2024, 12:30.

      Comment

      Working...
      X