Announcement

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

  • Asdoc & generation of table

    Dear all,

    I followed the wonderful asdoc command to create some tables.
    I have in my dataset the same identification number for the companies since I am looking over a period (2005-2010). For each observation, I have different variables from Compustat for which I would like to get the mean, min, p25 median p75 and the max but only for each distinct permno (all years combined).

    I used the following code:
    bys total(permno): asdoc sum var1 var2 var3 var4 var5 var6, stat(N mean sd min p25 median p75 max)
    It lists me line by line the stats for each different permno and the line that only interests me is the total line at the end of the list. How should I do to get the final line? Or should I create a table line by line with rowappend?

    In another table, I would like to show different data like the fraction of share (in %), the number of firms owing x subsidiaries (so counting permno given another variable) and the number of owned subsidiaries by firms (in that it would be counting var1 given permno). In this case, is it the only solution to create the table line by line with rowappend?

    Thank you very much for your insights.

  • #2
    Without seeing a sample of your data, it is difficult to come up with a code. As a first try, you may use this code
    Code:
    bys permno : asdoc sum var1 var2 var3 var4 var5 var6, stat(N mean sd min p25 median p75 max) replace
    Using a similar code with the grunfeld data, the table will look like this
    Code:
    webuse grunfeld
    bys company: asdoc sum invest mvalue kstock, stat(N mean sd min p25 median p75 max) replace
    .
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	63.8 KB
ID:	1564480




    asdocx is now avaialble
    A more powerful and flexible version of asdoc is now available. I call it asdocx. You may like to check the details here

    https://fintechprofessor.com/asdocx


    Please do remember to cite asdoc. To cite:

    In-text citation
    Tables were created using asdoc, a Stata program written by Shah (2018).

    Bibliography
    Shah, A. (2018). ASDOC: Stata module to create high-quality tables in MS Word from Stata output. Statistical Software Components S458466, Boston College Department of Economics.
    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


    • #3
      Hello Attaullah,

      Thank you for your reply ! This is what I used and I did not get what I wanted.
      This is a small subset of my dataset (which is over 13 000 +)

      permno var1 var2 var3 var4 var5 var6 subsidiaries ownership
      10002 2 3 4 5 6 7 Salmony 1 25
      10002 2 3 4 5 6 7 Salmony 2 50
      10002 2 3 4 5 6 7 Apple 100
      10002 2 3 4 5 6 7 Orange 50
      ​​​​​​​​​​​​​​10002 2 3 4 5 6 7 Avocado 45
      ​​​​​​​​​​​​​​​​​​​​​10892 8 9 5 7 8 6 Purple 100
      ​​​​​​​​​​​​​​​​​​​​​10892 8 9 5 7 8 6 Blue 66
      ​​​​​​​​​​​​​​​​​​​​​10892 8 9 5 7 8 6 Green 75
      20589 1 2 3 4 5 7 Salmony 1 75

      bys permno: asdoc sum var1 var2 var3 var4 var5 var6, stat(N mean sd min p25 median p75 max) gives me what you posted with the dataset. Unfortuntately since I have more than 13 000 observations it is not practical.
      Therefore I would like to have counted only the distinct permno (N would be for example 500 instead of 13000+) with the statistics such as mean, median, min & max.

      In another table, I would like to combine together different informations and I was wondering how it could look like with asdoc:
      I want the number of subsidiaries per permno (with the min/max/mean) and the number of permno per plant with as well the statistics of ownership.
      I provided an example where each permno has different subsidiaries but for example Salmony 1 is owned by both permno 10002 & 20589.

      I hope you understand better what I meant,
      Eugene

      Comment


      • #4
        " I would like to have counted only the distinct permno (N would be for example 500 instead of 13000+) with the statistics such as mean, median, min & max
        " this part is not clear to me. The above code that I posted reports statistics for each unique company, it does not repeat observation. You have multiple groups (permnos), multiple variables, and multiple statistics, there is no other way than the one shown above for reporting them.
        Please come up with a dummy output table that shows what type of table are you expecting.

        For the second table, option row() can be used. Further, asdocx creates such tables with more ease and flexibility.
        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

        Working...
        X