Forum Replies Created

Viewing 15 posts - 31 through 45 (of 80 total)
  • Author
    Posts
  • Attaullah Shah
    Moderator
    Post count: 80

    I am happy to announce that asdocx now supports mrtab program that is written by Ben Jann. Adding mrtab was quite a laborious task. I had to assemble the result matrices from various components, which required a significant amount of time. See details here https://asdocx.com/asdocx-with-mrtab-tabulates-multiple-responses-in-stata-asdoc/

    Attaullah Shah
    Moderator
    Post count: 80

    I am happy to announce that asdocx now supports fre program that is written by Ben Jann. See details here https://asdocx.com/use-fre-with-asdocx-in-stata/

    Attaullah Shah
    Moderator
    Post count: 80

    I like the idea of creating such a list.
    Adding support for user-written programs to asdocx can be straightforward if the program produces its results in the form of macros, scalars, or matrices. However, if this is not the case, it would be equivalent to writing the user’s program from scratch. I am always available to assist other asdocx users who would like to add support for community-contributed packages to asdocx. I can share the template file and provide guidance on how to use it to add programs to asdocx.

    Attaullah Shah
    Moderator
    Post count: 80

    I took some time today to update flexmat. The addparts sub-command now accurately adds notes and titles to the tables that are appended using the appendmat command. I have updated the provided example to reflect these changes.

    Attaullah Shah
    Moderator
    Post count: 80

    Thank you for your valuable feedback. You can view your contribution in the flexmat help file, as I have incorporated your example into the appendmat section. In the next update, I will also include your name in the acknowledgement section.

    I had originally planned to add titles and notes when using the appendmat subcommand at a later time, but your message has provided me with renewed motivation and I will try to find the time to work on it soon.”

    Attaullah Shah
    Moderator
    Post count: 80

    Thanks for bringing this up. I have improved the functionality of flexmat, and as a result, I have updated the asdocx files. To get the updates, use

    asdocx_update

    This thread will be useful to other users of asdocx and flexmat, therefore, I will provide a detailed reply.
    The appendmat sub-command appends a flexmat file to the current asdocx file (that is is available in the global macro $active_flexmat_file). Users must use the option matname() when using appendmat(). The subcommand is similar to addmat, but with three main differences:

    1. Users do not have to specify the location() option as appendmat automatically identifies the next available location and appends the flexmat file to it.

    2. Files written with flexmat are stored as associative arrays, therefore, they need to be converted back to matrices before appending them to other files. The sub-command appendmat takes care of this.

    3. The addmat subcommand can be used to add a matrix at any combination of rows and columns, potentially replacing an existing matrix or table. In contrast, the appendmat command will always append the flexmat file to a new location, resulting in the addition of a new table to the file.

    Here is a typical use of the sub-command appendmat.

      * Specify the flexmat filename using asdocx
      asdocx setfile, save(First_Test)
    
      * Add contents to the file First_Test
      flexmat addrow, data(Year, Month, Day) r(1)
      flexmat addrow, data(2001, March, 21) r(2)
    
      * Add notes and title to the table
      flexmat addparts, title(Table: Test Results for Sample A) /// 
      notes(Sample A was tested for contaminants X, Y, and Z.)
    
      * Create another flexmat file and add contents
      asdocx setfile, save(Second_Test)
      flexmat addrow, data(Make, Model, mpg) r(1)
      flexmat addrow, data(Ford, Explorer, 15) r(2)
    
      * Add notes and title to the table
      flexmat addparts, title(Table: Test Results for Sample B) /// 
      notes(Sample B was tested for contaminants A, B, and C)
    
    
      * Create asdocx file and append the earlier two flexmat files to it
      asdocx, save(REPORT) text(MY REPORT) title replace
      flexmat appendmat, matname(First_Test)
      flexmat appendmat, matname(Second_Test)
    
      * Export the asdocx file to MS Word
      asdocx export
    

    * Note on file names
    The setfile option of ‘asdocx’ causes ‘flexmat’ to store its files in the _asdoc folder, located in the user’s current directory. This folder is hidden by default to avoid visual clutter and accidental deletion. In the examples given, the files First_Test and Second_Test are stored as First_Test.flexmat and Second_Test.flexmat, respectively, in the hidden directory. Users do not need to specify the folder path or the extension, as flexmat automatically retrieves files from the hidden the directory and adds the .flexmat extension.

    When users are confident that they no longer need to store the asdocx’s working files, they can use:

    asdocx clear

    This will delete all raw files in the “_asdoc” folder.

    Attaullah Shah
    Moderator
    Post count: 80

    Thanks for reporting this. I have fixed it now. Please update and test the new version.

    asdocx_update
    
    webuse citytemp2, clear
    
    asdocx tab region agecat, row   replace
    
                           Tabulation of region agecat
      0 |1                                        2            3           4           5 
    ----+-------------------------------------------------------------------------------------
      1 | Census region                Age category                                      
      2 |                                     19–29        30–34         35+       Total 
    ----+-------------------------------------------------------------------------------------
      3 |NE                                      46           83          37         166 
      4 |                                    27.711           50      22.289         100 
      5 |N Cntrl                                162           92          30         284 
      6 |                                    57.042       32.394      10.563         100 
      7 |South                                  139           68          43         250 
      8 |                                      55.6         27.2        17.2         100 
      9 |West                                   160           73          23         256 
     10 |                                      62.5       28.516       8.984         100 
     11 |Total                                  507          316         133         956 
     12 |                                    53.033       33.054      13.912         100 
    ------------------------------------------------------------------------------------------
    Notes: First row has frequencies, and second row has row percentages.
    
    Attaullah Shah
    Moderator
    Post count: 80

    Adding all community contributed packages to asdocx is a daunting endevour. I have added several of them to asdocx and shall add several others, given that such packages are widely used in the Stata community. I have added xtgcause to asdocx. First update asdocx with

    asdocx_update

    . Here is a working example (I am using the dataset mentioned in the help file of xtgcause package.

    asdocx xtgcause y x, lag(1) replace
    
             Dumitrescu & Hurlin (2012) Granger non-causality test results
      0 |1                                     2                  3 
    ----+-----------------------------------------------------------------------------
      1 |Stat                              value            p-value 
    ----+-----------------------------------------------------------------------------
      2 |Lag order:                            1                    
      3 |W-bar                             1.291                    
      4 |Z-bar                             0.650              0.515 
      5 |Z-bar tilde                       0.259              0.796 
    ----------------------------------------------------------------------------------
    H0: x does not Granger-cause y. H1: x does Granger-cause y for at least one panelvar (id).
      
    Click to Open File:  C:\temp\MyFile.docx
    
    
    Attaullah Shah
    Moderator
    Post count: 80

    The default setting in asdocx is to append results to the same file which you used previously in the save() option. If you did not use the save() option, then the default name of “Myfile.docx” is used.
    If you want to save the results to a new file, use the save() option with filename in the brackets. So, to write results to Results2, the code will be:

    bys activityear: asdocx sum amtfunded2 if clientstate1=="Maryland", save(Results2)
    Attaullah Shah
    Moderator
    Post count: 80

    Let’s assume that you have a folder named temp in drive c and you have several .dta files in it. You wish to create a codebook from all the .dta files and save them to codebook.docx file. The following code will do the job.

    
     local files : dir "c:/temp" files "*.dta" 
     cd c:/temp
    
     foreach file in  `files'  {
    
            use  `file'  , clear
     	asdocx codebook , save(codebooks.docx)
     }
    
    
    Attaullah Shah
    Moderator
    Post count: 80

    For setting decimal points in an asdoc’x document, I encourage you to visit this page https://asdocx.com/decimal-points/. If you wish to change decimal points for a single column, see the Section 4 on the above page.

    In the following example, I am setting 11 decimal points for the second column, note the 2 in c2_dec(11). If you wish to target another column, just change the # part in c#_dec().

    sysuse auto
    
    asdocx reg pr2, replace c2_dec(11) nest 
                                 
                             Table: Regression results
    
      0 |1                                                 2 
    ----+-----------------------------------------------------------------------------
      1 |                                                (1) 
      2 |Variables                                       pr2 
    ----+-----------------------------------------------------------------------------
      3 |Intercept                             06.165e-07*** 
      4 |                                       (03.429e-08) 
      5 |Observations                                     74 
      6 |R2                                                0 
    ----------------------------------------------------------------------------------
    Notes:  Standard errors are in parentheses. *** p<.01, ** p<.05, * p<.1
    
    Attaullah Shah
    Moderator
    Post count: 80

    You need to add the variable name in the loop, try this:

    loc NextRow 2
    flexmat reset
    flexmat  addrow, data (Variable, Obs, Mean, Std.Dev., Max, Min) row(1)
    
    foreach var in twear tnonwear move comm mon oth {
    
        sum nrobot_`var'
    
        flexmat  addrow, data (`var', `r(N)',`r(mean)', `r(sd)',`r(max)', `r(min)') row(`NextRow') dec(3)
        loc ++NextRow
    }
    asdocx export
    
    Attaullah Shah
    Moderator
    Post count: 80

    asdocx uses matcell(), matrow() and matcol() internally to constructs the frequency table. Therefore, users cannot use these options. If you must use these options and also need asdocx with tab command, the workaround is use the tab command twice: once with asdocx and second without asdocx. In the second case, you may added these options.

    Attaullah Shah
    Moderator
    Post count: 80

    You can enter Stata codes and output inside the <pre> </pre> tags, e.g., <pre> some Stata code here </pre> This will appear as:

    some Stata code here

    Please also note that html converts the Stata’s local macro symbol ` to code, therefore, you need to use the html escape sequence of &grave; instead of ` You can also write it as &#96; instead of &grave;.

    Attaullah Shah
    Moderator
    Post count: 80

    asdocx keeps backup of all the files it creates. These backups can be used to re-generate Excel, Word, Html, or Latex files. If you are writing to two files at the same time, you need to just remember the files names. Once they are ready for export, supply the file name in the save() option. In your case, you can export the two files with:

    asdocx export, save(Abstract Results Draft)
    asdocx export, save(Abstract Tables)
Viewing 15 posts - 31 through 45 (of 80 total)