Announcement

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

  • Asdoc fails to write word file and run multiple group statistics

    I have used asdoc for reporting the results in word file but unable to do this. I used this code which did not run

    asdoc bysort type_facility gov_csby_pvtins: sum medical_cost2

    and did not write word file for this code: (I tried with text() option as well)

    asdoc bysort disease: sum medical_cost2, text()



    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(disease type_facility medical_cost2 gov_csby_pvtins)
     2 1     0 1
    12 1  2000 1
    13 1     0 1
     9 1     8 1
     6 1    60 1
     9 1     0 1
     9 1     0 1
    15 1     0 1
     7 1     0 1
     7 1     0 1
     2 1     0 1
     7 1     0 1
     8 1     0 1
     6 1     0 1
     9 1     0 1
     9 1     0 1
     9 1     0 1
     2 1     0 1
     9 1     0 1
    13 1     0 1
    14 1     0 1
     7 1     0 1
    16 1     0 1
    14 1     0 1
     2 1     0 1
     5 1     0 1
     7 1     0 1
     9 1     0 1
     7 1     0 1
    10 1     0 1
    13 1     0 1
    14 1     0 1
     7 1     0 1
    14 1     0 1
    10 1  5000 1
     1 1  2500 1
    14 1     0 1
     9 1     0 1
    19 1     0 1
     2 1     0 1
     7 1     0 1
     9 1     0 1
     7 1   500 1
    17 1     0 1
     2 1   500 1
     1 1     0 1
     2 1     0 1
    14 1     0 1
     5 1     0 1
    11 1   500 1
     8 1     0 1
     2 1     0 1
    16 1     0 1
     9 1     0 1
     9 1     0 1
     7 1   210 1
    13 1     0 1
     9 1     0 1
     2 1     0 1
    13 1     0 1
     9 1     0 1
    15 1     0 1
    14 1     0 1
     7 1     0 1
     9 1     0 1
     7 1     0 1
    10 1     0 1
     6 1     0 1
     5 1  2800 1
    14 1   300 1
     7 1     0 1
     1 1     0 1
    10 1     0 1
     2 1     0 1
     7 1     0 1
    12 1   200 1
    11 1     0 1
    11 1     0 1
     9 1     0 1
     9 1     0 1
    19 1     0 1
     2 1     0 1
     9 1     0 1
     7 1     0 1
    13 1     0 1
    13 1     0 1
     2 1     0 1
     5 1     0 1
     4 1     0 1
    10 1     0 1
     7 1     0 1
    14 1     0 1
     6 1     0 1
    11 1     0 1
    14 1     0 1
     1 1     0 1
     9 1     0 1
     9 1     0 1
     8 1     0 1
    12 1 25000 1
    end
    label values disease disease1
    label def disease1 1 "Cancer", modify
    label def disease1 2 "Cardiovascular Issues", modify
    label def disease1 4 "ENT", modify
    label def disease1 5 "Gastro-Intestinal Issues", modify
    label def disease1 6 "General", modify
    label def disease1 7 "Infectious Disease", modify
    label def disease1 8 "Injuries", modify
    label def disease1 9 "Maternal Health", modify
    label def disease1 10 "Metabolic Disease", modify
    label def disease1 11 "Nephrology", modify
    label def disease1 12 "Neurology", modify
    label def disease1 13 "Opthalmology", modify
    label def disease1 14 "Orthopaedic Issues", modify
    label def disease1 15 "Psychological Issues", modify
    label def disease1 16 "Respiratory Issues", modify
    label def disease1 17 "Surgery", modify
    label def disease1 19 "Deficiences", modify
    label values type_facility new
    label def new 1 "Govt", modify
    label values gov_csby_pvtins gov_csby_pvt_ins
    label def gov_csby_pvt_ins 1 "Govt CSBY No", modify
    Thank you so much in advance.

    Ashish

  • #2
    Hey Ashish,

    I can replicate your error only for the first example of your code (asdoc bysort type_facility...). The second examples works fine with the data you provided and produces a word file. It looks to me that asdoc can only handle one variable by which it is supposed to provide summary statistics. If you run the following it seems to work:

    Code:
    asdoc bysort type_facility: sum medical_cost2
    Best
    Sebastian





    Comment


    • #3
      Sebastian is right. asdoc supports one variable with
      Code:
      bysort varname: sum
      . If you need more flexibility, you may like to asdocx, see details here https://fintechprofessor.com/asdocx/
      Last edited by Attaullah Shah; 18 Apr 2023, 10:17.
      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


      • #4
        Originally posted by Sebastian Schirner View Post
        Hey Ashish,

        I can replicate your error only for the first example of your code (asdoc bysort type_facility...). The second examples works fine with the data you provided and produces a word file. It looks to me that asdoc can only handle one variable by which it is supposed to provide summary statistics. If you run the following it seems to work:

        Code:
        asdoc bysort type_facility: sum medical_cost2
        Best
        Sebastian




        Hi,
        The code runs very well on these 100 cases only what I have mentioned using dataex, but fails to write if cases are 581 in my case.
        asdoc bysort disease: sum medical_cost2, text()

        error is: option text() required

        Attached is data set for you reference

        Ashish
        Attached Files

        Comment

        Working...
        X