Announcement

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

  • Asdoc replacing all tables with last combination

    I am using asdoc to create a crosstab for different variables within a loop. What I observe is that the result of the last combination gYear19 and gYear20 replaces all previous tables result. Am I doing something wrong? See code below

    Code:
    clear
    set obs 10000
    forval a=1/20{
     gen Year`a'=runiform()*100
     egen gYear`a'=cut(Year`a'), at(0(10)100) label
    }
    
    forval a=2/20{
    local b =`a'-1
    
    asdoc tab gYear`b' gYear`a', row nofreq nokey label append
    
    }
    Thank you.

  • #2
    Welcome to Statalist.

    Your sample code works for me. Are you using the latest version of asdoc?
    Code:
    . which asdoc
    /Users/lisowskiw/Library/Application Support/Stata/ado/plus/a/asdoc.ado
    *! Attaullah Shah; [email protected]
    *! Tenured Associate Professor at the Institute of Management Sciences, Peshawar, Pakistan.
    *!-------------------------------------------------------------------------------
    *! Version 2.3.6.5 : Changes made on October 12, 2019   : table command now works even with no s
    which I installed using
    Code:
    . net install asdoc.pkg, from(http://fintechprofessor.com/)
    With that said, a very common source of problems like this is that you are looking at an older version of your output file in a different directory than your current version is being created in.Try including the save() option to give your output a name different than Myfile.doc, then you'll know you're looking at the right place.
    Code:
    . forval a=2/20{
      2. local b =`a'-1
      3. 
    . asdoc tab gYear`b' gYear`a', row nofreq nokey label append save(gnxl.doc)
      4. }
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    Click to Open File:  gnxl.doc
    
    .
    and when I click on gnxl.doc I see all the tables.

    Comment


    • #3
      Originally posted by William Lisowski View Post
      Welcome to Statalist.

      Your sample code works for me. Are you using the latest version of asdoc?
      Code:
      . which asdoc
      /Users/lisowskiw/Library/Application Support/Stata/ado/plus/a/asdoc.ado
      *! Attaullah Shah; [email protected]
      *! Tenured Associate Professor at the Institute of Management Sciences, Peshawar, Pakistan.
      *!-------------------------------------------------------------------------------
      *! Version 2.3.6.5 : Changes made on October 12, 2019 : table command now works even with no s
      which I installed using
      Code:
      . net install asdoc.pkg, from(http://fintechprofessor.com/)
      With that said, a very common source of problems like this is that you are looking at an older version of your output file in a different directory than your current version is being created in.Try including the save() option to give your output a name different than Myfile.doc, then you'll know you're looking at the right place.
      Code:
      . forval a=2/20{
      2. local b =`a'-1
      3.
      . asdoc tab gYear`b' gYear`a', row nofreq nokey label append save(gnxl.doc)
      4. }
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      Click to Open File: gnxl.doc
      
      .
      and when I click on gnxl.doc I see all the tables.
      Do you get the correct result? I rerun the code, the same problem occur.

      Comment


      • #4
        I'm sorry, I misunderstood your description of the problem.

        I see now that you mean that although 19 separate tables are created and titled "Tabulation of gYear1 gYear2" through "Tabulation of gYear19 gYear20", all have the same values in their cells. This is astonishing to me.

        I note that if I remove the nofreq and row options, the counts in each table are now different, and only a single "Click to open ..." appears.

        I also note that if I replace "clear" with "clear all", which not only clears Stata but also Mata, I get an error from Mata when the asdoc command is run,

        Perhaps the author of asdoc, Attaullah Shah , who frequently addresses questions on Statalist, will see this and enlighten us.


        Comment


        • #5
          Thanks for reporting this. Actually, option row was not properly parsed when option nofreq was used. I have fixed that. The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.
          Code:
          net install asdoc, from(http://fintechprofessor.com) replace
          Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.

          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


          • #6
            Thank you.

            Comment


            • #7
              Originally posted by Attaullah Shah View Post
              Thanks for reporting this. Actually, option row was not properly parsed when option nofreq was used. I have fixed that. The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.
              Code:
              net install asdoc, from(http://fintechprofessor.com) replace
              Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.
              .
              Thank you for the update. Unfortunately, I am still experiencing the same bug after updating the package and restarting STATA.

              I use the following code to produce two tables in one doc.
              Code:
              asdoc tabulate x y, row nofreq append
              asdoc tabulate a b, row nofreq append
              However, in the resulting Word doc I only have the row percentages from the first tabulate command inside both tables.
              Before the update - as described by your last post - I only had the row percentages from the second tabulate command inside both tables.
              If i drop the nofreq, the results are fine and I also do not have the issue when working with 'column' instead of 'row'.
              (I am using STATA version 16.1)

              Attaullah Shah, do you have an idea where I could further look into? Thanks in advance.

              Regards,
              Niklas
              Last edited by Niklas Schaefer; 19 Aug 2020, 06:41.

              Comment


              • #8
                I have fixed that.
                The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.
                Code:
                net install asdoc, from(http://fintechprofessor.com) replace
                which asdoc
                *! Version 2.3.8.1 : Changes made on August 19, 2020   : Fix to Option row in tabulate when used with nofreq option.
                An Example
                Code:
                sysuse nlsw88, clear
                asdoc tab age race, nofreq row replace
                asdoc tab race south , nofreq row
                Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	47.3 KB
ID:	1569177


                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


                • #9
                  Works like a charm.
                  Thank you for the prompt reply and the update. I will definetely look into asdocx.

                  (Just to let you know, the "Order now" Button on your price page forwards to the theme's template and not your actual order page)

                  Best,
                  Niklas

                  Comment


                  • #10
                    Niklas Schaefer Thanks for pointing out the incorrect hyperlink.
                    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


                    • #11
                      Code:
                         
                      net install asdoc, from(http://fintechprofessor.com) replace
                      which asdoc
                      *! Version 2.3.8.1 : Changes made on August 19, 2020   : Fix to Option row in tabulate when used with nofreq option.
                      
                      sysuse nlsw88, clear
                      asdoc tab age race, nofreq row replace
                      asdoc tab race south , nofreq row
                      Attached Files

                      Comment


                      • #12
                        The current version of asdoc is Version 2.3.9.1 : Changes made on Nov 3, 2020
                        The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.
                        Code:
                        net install asdoc, from(http://fintechprofessor.com) replace
                        Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.

                        Also check asdocx here



                        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

                        Working...
                        X