Announcement

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

  • summarize variable, detail but for each year

    Solved!

    For others:

    [CODE]
    bysort year: sum lnhourlyw, detail
    [\CODE]

    Sorry, I was looking for other codes like xtsum etc.
    Last edited by Anshul Anand; 17 Oct 2018, 08:23.

  • #2
    One option is something like:

    Code:
    sysuse auto, clear
    
    g year = mod(_n, 5)
    bys year: su price, d
    
    
    **but I find this more useful
    tabstat price, by(year) s(min p10 p25 p50 p75 p90 max N)
    Eric A. Booth | Senior Director of Research | Far Harbor | Austin TX

    Comment


    • #3
      Thank you very much! This is really more useful!

      Comment


      • #4
        asdoc (from SSC) can find normal , customized and detailed summary statistics over a grouping variable and create a nicely formatted tables in MS word. See this example
        Code:
         ssc install asdoc
        
        bysort year: asdoc tabstat lnhourlyw, stat(min p10 p25 p50 p75 p99 max N)
        And using the eric_a_booth example, we get
        Code:
         sysuse auto, clear
        g year = mod(_n, 5)
        asdoc tabstat price, by(year) stat(min p10 p25 p50 p75 p99 max N)
        The output is given below.
        Click image for larger version

Name:	asdoc by.png
Views:	1
Size:	30.1 KB
ID:	1466314



        For more options and customized statistics, you can watch this YouTube Video.
        Regards
        --------------------------------------------------
        Attaullah Shah, PhD.
        Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
        FinTechProfessor.com
        https://asdocx.com
        Check out my asdoc program, which sends outputs to MS Word.
        For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

        Comment


        • #5
          Dear Dr Shah,
          Thanks for the great program. Really appreciate it. A question : If I were to 1) add text to the document myfile.doc which was already created by asdoc, but this time using the microsoft word program and opening the word file on the computer, and then 2) save the file and then after that 3) again if I try to append another table to the same document using append option, then I get an error "not enough space in memory or disk". This error does not occur if were to continue to adding tables using append option from the asdoc program itself without ever editing it outside stata using asdoc command. Is this something intended: that once I modify the document myself outside stata using msword (not using asdoc) then I can no longer add tables using asdoc. (sorry I hope my language adequately describes the issue)
          kind regards
          RS

          Comment


          • #6
            ram singh asdoc creates files in the rich text format (RTF), when you edit the file with MS Word and save it, the file is converted to the native Word format and loses all functionalities of the RTF format. Therefore, asdoc cannot write to this file in RTF format anymore. So it is a good idea to first complete your tables and text writing from asdoc and then modify the file in MS Word.
            Regards
            --------------------------------------------------
            Attaullah Shah, PhD.
            Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
            FinTechProfessor.com
            https://asdocx.com
            Check out my asdoc program, which sends outputs to MS Word.
            For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

            Comment


            • #7
              Got it Dr Shah !! thanks so much,
              kind regards
              RS

              Comment

              Working...
              X