asdocx: Export from Stata to Word, Excel, LaTeX & HTML Forums asdocx Forum Using asdocx with the groups command in Stata

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • Isabel Krakoff
    Participant
    Post count: 12

    I’m trying to use asdocx with groups and it is not working

    my code:

    asdocx groups pctCompliants country_year if pctCompliants ~=., show(none) colorder(2 1) ///
    select(-10) replace save(Tables/Descriptive) dec(5) fs(12) font(Times New Roman)
    
    

    results:
    When I don’t use asdocx the output is exactly what I want –

      +---------------------------------+
      |        country_year   pctComp~s |
      |---------------------------------|
      |      Vietnam (2006)   .63083166 |
      |        China (2007)   .64825428 |
      |  Korea South (1982)   .68664563 |
      |      Finland (1981)   .69130868 |
      | Saudi Arabia (2003)   .70359713 |
      |---------------------------------|
      |       Norway (1982)   .71251196 |
      |        China (2001)   .77688444 |
      |      Hungary (1982)   .77754533 |
      |      Vietnam (2001)   .80260521 |
      |        Qatar (2010)   .80718338 |
      +---------------------------------+
    

    When I try to add asdocx using the code above, the output in Stata looks like this and nothing outputs to the word document –

      +---------------------------------------------------+
      |        country_year   pctComp~s   Freq.   Percent |
      |---------------------------------------------------|
      |      Vietnam (2006)   .63083166    1479      0.30 |
      |        China (2007)   .64825428    1919      0.38 |
      |  Korea South (1982)   .68664563     951      0.19 |
      |      Finland (1981)   .69130868    1001      0.20 |
      | Saudi Arabia (2003)   .70359713    1390      0.28 |
      |---------------------------------------------------|
      |       Norway (1982)   .71251196    1047      0.21 |
      |        China (2001)   .77688444     995      0.20 |
      |      Hungary (1982)   .77754533    1434      0.29 |
      |      Vietnam (2001)   .80260521     998      0.20 |
      |        Qatar (2010)   .80718338    1058      0.21 |
      +---------------------------------------------------+
    

    I tried outputting to an excel spreadsheet and I get the error "invalid column range in rowvector[1,2]"
    Based on my attempt using regular asdoc, I think that one issue is that Korea South (1982) is registering as Korea in one col and South (1982) in another col which is throwing off the whole format of the table.

    Any insight would be tremendously helpful, especially since the groups command itself doesn’t have any super useful means for exporting its output.

    I love your product so much! It is the most intuitive, user-friendly, and easy way to export results of all kinds and I’ve tried them all!

    Dr. Attaullah Shah
    Keymaster
    Post count: 106

    Hello Isabel
    Since groups command is not an official Stata command, asdocx is not aware of it. Therefore, you are receiving the mentioned error. On your request, I have worked on it and have added it to asdocx. You should update asdocx with the following code

    asdocx_update

    Once installed, you can use asdocx with the groups command in a usual manner. Following is an example from the help file of the groups command.

    webuse nlswork
    asdocx groups collgrad not_smsa c_city south, order(high)
      
    
    
    ----+---------------------------------------------------------------------------------
      1 |college gradu               SMSA    central city     south   frequency     percent 
    ----+---------------------------------------------------------------------------------
      2 |0                              0           0           0        5742      20.129 
      3 |0                              0           1           0        4941      17.321 
      4 |0                              1           0           1        3982      13.959 
      5 |0                              0           1           1        3455      12.112 
      6 |0                              1           0           0        3086      10.818 
      7 |0                              0           0           1        2527       8.859 
      8 |1                              0           0           0        1412       4.950 
      9 |1                              0           1           0        1096       3.842 
     10 |1                              0           1           1         698       2.447 
     11 |1                              0           0           1         598       2.096 
     12 |1                              1           0           0         566       1.984 
     13 |1                              1           0           1         423       1.483 
    --------------------------------------------------------------------------------------
    
    
    
    Isabel Krakoff
    Participant
    Post count: 12

    Wow, thank you so much! It works perfectly now 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.