Announcement

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

  • How to export descriptive statistics (-desctable- not working)

    Hello,

    I am trying to find the best Stata command to export descriptive information into an excel table...but I'm having trouble. I obtained the -desctable- package but when I run even the example tables from the -desctable- help file, I receive errors about an "invalid name". I am able to open an exported excel file despite this error but it shows only the variable names (no values)...I attached a screenshot. I'm not sure what is going wrong. Any suggestions?

    My Data: I am examining immigrant student's age-at-arrival in the US (variable code: schaaa) and their college-going outcomes (variable code: clg4). I started by trying out the -desctable- example code from the help file but I cannot get it to work. I also tried the -desctable- command with my own variables and I have the same issue as with the example code, where I get an excel file with only the variable names, no values.

    Desctable Syntax: desctable i.clg4 i.stusex if subpop11==1, filename("tabletjes") group(schaaa) stats(count)

    My end goal: is to export a table that will look something like this (I normally use many "tab" commands to get this information but I want to create one table with one command if possible):
    US born (%)
    (count)
    Pre-Sch Arrival Elem.Sch Arrival Mid.Sch Arrival High Sch.Arrival Total (count)
    Enrolled in 4yr college 37%
    6,836 (count)
    51%
    253 (count)
    41%
    201 (count)
    37%
    65 (count)
    32%
    29 (count)
    7,384
    Female 50%
    9,548 (count)
    55%
    288 (count)
    49%
    255 (count)
    49%
    96 (count)
    49%
    54 (count)
    ...etc.
    …etc.
    Is -desctable- the appropriate command to use? Is there another command I should try?

    Thank you so much for your time!
    Attached Files

  • #2
    Here is a solution based on asdoc, which can export to MS Word. If you need to export to Excel, you may like to explore asdocx, which has dozens of other features.


    Code:
    net install asdoc, from(http://fintechprofessor.com) replace
    sysuse nlsw88
    asdoc sum age i.race i.union i.collgrad tenure i.occupation hours, replace save(desc.doc)
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	67.8 KB
ID:	1607966


    asdocx is now available
    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
      Irina Chukhray this problem must have developed recently due to the underlying code. I am trying to rerun code from a couple of months ago and I'm now receiving the same error as you, although the code previously used case-wise deletion to handle the problem. You can probably use the "listwise" option at the end of the code and it will produce the table but you'll lose observations.

      Comment

      Working...
      X