Announcement

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

  • New SSC command for exporting summarize results and comparing them across datasets

    Good time of day,

    I'm sharing a small ado file for exporting results of the summarize command for all variables in data as a new dataset or as a DTA file using statsby.
    I know that many people, including me, were researching this topic and other export commands like estpost - estout do not integrate with MS Excel very well.
    The command, summarizeby, uses the same syntax as statsby and is available from SSC (ssc install summarizeby). Here are some examples:

    Code:
    * simple usage
    sysuse auto, clear
    summarizeby, clear
    
    * apply statsby syntax
    sysuse auto, clear
    summarizeby, clear by(foreign)
    
    * save into file
    sysuse auto, clear
    summarizeby, saving(summarise)
    
    * compare data
    sysuse auto, clear
    tempfile f
    summarizeby mean=r(mean) sd=r(sd), saving(`f')
    drop if mpg > 20
    summarizeby mean=r(mean) sd=r(sd), clear
    append using `f', gen(id)
    order id
    label define data 0 "original" 1 "changed"
    label values id data
    
    * export to excel
    export excel * using "summarize.xlsx", firstrow(variables) replace
    This is my first contribution to SSC, please don't be too judgemental :-)
    Let me know if something doesn't work or you require additional features (for example, I don't really use if and in with summarize or statsby). Thank you!
    Last edited by Ilya Bolotov; 17 Nov 2020, 12:27.

  • #2
    summarizeby is now fully compatible with statsby with a correct description and help file.

    There is a mistake in my example, should be
    Code:
    label define data 0 "changed" 1 "original"
    Sorry.

    Comment


    • #3
      Dear Ilya,

      With interest I am exploring your command summarizeby.
      First, I am not certain about the version that I have installed using the ssc server.
      The which command results in:
      Code:
      which summarizeby
      *! version 1.1.0  20nov2020
      If it is the last version, I suggest that you update the date stamp and version reference.

      Next, I note that in the help file of summarizeby you did not include any reference to you as the author etc.
      I suppose that is not what is expected, at least by me, so I suggest to include that.
      See, for example:
      Code:
      ssc install fre
      h fre
      Best,
      Eric
      http://publicationslist.org/eric.melse

      Comment


      • #4
        Dear Eric,

        First of all, thank you fro your feedback! I'm not developing ado files for fame.
        You can find the information about the author of each command using
        Code:
        ssc desc summarizeby
        However, I was planning to update the routine anyway so I will include this information as well.
        Would like to have the option detail in summarizeby?

        Comment


        • #5
          Dear Ilya,

          Sorry to respond with such delay, but indeed, I think it is useful to have the option detail available in summarizeby?
          So, possibly you have time to implement this as well.
          http://publicationslist.org/eric.melse

          Comment

          Working...
          X