Announcement

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

  • Exporting results with asdoc - Error message because part of command not known "set_column_formats() not found"

    Hello everyone,
    I wrote a code in Stata 17.0 in which I compute pairwise correlations between several variables. It looks the following:
    Code:
      
    local score_vars "score1 score2 score3"
    local Cons_vars "Cons_fmc Cons_fc Cons_total"
    local sex "Male Female Both"  
    
    foreach var of varlist `score_vars' {    
    foreach s of local sex {        
    asdoc pwcorr `var' prevalence death_rate if sex == "`s'" & year < 2020, sig star(all) replace save(`var'_Prevalence_`s'.doc)    
    }
    }
    Here is an extract from my data:
    Code:
     
    +----------------------------------------------------------------------------------------------------------------------------------------------------+      
    | country   year    Cons_fmc     Cons_fc   Cons_to~l   score1  countr~d   sex_id      sex   death_r~e   id_comb   prevalence   score2  score3      |----------------------------------------------------------------------------------------------------------------------------------------------------|  
    1. | Austria   2003   1.506e+10   4.459e+08   1.551e+10         31         75        3     Both   90.557087   7532003   .37774534         31         31 |  
    2. | Austria   2003   1.506e+10   4.459e+08   1.551e+10         31         75        1     Male   153.48267   7512003   .42140222         31         31 |  
    3. | Austria   2003   1.506e+10   4.459e+08   1.551e+10         31         75        2   Female   48.841131   7522003   .33607754         31         31 |  
    4. | Austria   2004   1.446e+10   4.885e+08   1.495e+10          .         75        3     Both   88.068512   7532004   .37240338         31         31 |  
    5. | Austria   2004   1.446e+10   4.885e+08   1.495e+10          .         75        1     Male   148.62213   7512004   .41616637         31         31 |      |----------------------------------------------------------------------------------------------------------------------------------------------------|  
    6. | Austria   2004   1.446e+10   4.885e+08   1.495e+10          .         75        2   Female   47.449177   7522004   .33040813         31         31 |  
    7. | Austria   2005   1.328e+10   6.492e+08   1.393e+10         31         75        1     Male   144.02972   7512005    .4101998         31         31 |  
    8. | Austria   2005   1.328e+10   6.492e+08   1.393e+10         31         75        2   Female   47.048813   7522005   .32304652         31         31 |  
    9. | Austria   2005   1.328e+10   6.492e+08   1.393e+10         31         75        3     Both   86.217246   7532005   .36584796         31         31 |  
    10. | Austria   2006   1.388e+10   6.933e+08   1.458e+10          .         75        1     Male   139.06223   7512006   .40398165         31         33 |      |----------------------------------------------------------------------------------------------------------------------------------------------------|  
    11. | Austria   2006   1.388e+10   6.933e+08   1.458e+10          .         75        3     Both    83.97748   7532006   .35892631         31         33 |  
    12. | Austria   2006   1.388e+10   6.933e+08   1.458e+10          .         75        2   Female   46.255099   7522006   .31528362         31         33 |  
    13. | Austria   2007   1.358e+10   7.661e+08   1.435e+10         35         75        2   Female   46.354397   7522007   .30827643         35         35 |  
    14. | Austria   2007   1.358e+10   7.661e+08   1.435e+10         35         75        1     Male   136.33019   7512007   .39861671         35         35 |  
    15. | Austria   2007   1.358e+10   7.661e+08   1.435e+10         35         75        3     Both   83.236305   7532007   .35279109         35         35 |      |----------------------------------------------------------------------------------------------------------------------------------------------------|  
    16. | Austria   2008   1.319e+10   8.363e+08   1.402e+10          .         75        2   Female   46.450941   7522008   .30154246         35         34 |  
    17. | Austria   2008   1.319e+10   8.363e+08   1.402e+10          .         75        1     Male   132.59051   7512008   .39352382         35         34 |  
    18. | Austria   2008   1.319e+10   8.363e+08   1.402e+10          .         75        3     Both   82.007304   7532008   .34691982         35         34 |  
    19. | Austria   2009   1.338e+10   8.542e+08   1.424e+10          .         75        2   Female   47.040269   7522009   .29513325         35         33 |  
    20. | Austria   2009   1.338e+10   8.542e+08   1.424e+10          .         75        3     Both   82.516005   7532009   .34136417         35         33 |      +----------------------------------------------------------------------------------------------------------------------------------------------------+
    It worked fine last week and I was able to export all my result. However, when I added one line to produce a scatterplot to the code today, I was not able to run the code again. I always get the following error message: <istmt>: 3499 set_column_formats() not found

    Does anyone know why the code stopped working and how I can make it work again?

    Thank you very much in advance!

    Nina König


    Tags: None

    Last edited by Nina Koenig; 09 Jun 2023, 01:53.

  • #2
    That looks like a call to a Mata function: asdoc can't see the code.

    See the results of

    Code:
    ssc desc asdoc
    You need to install all of these files:

    Code:
     asdoc.ado
          asdoc.sthlp
          ../l/lasdoc.mlib
    That said, if you didn't do that earlier, my wild guess is that there would have been a different error message. But although most of the .mlib file is unreadable, set_column_formats() is detectable as a function name.

    The best way to install is using ssc.

    It's a good idea to ping the author Attaullah Shah for queries on this command.

    Comment


    • #3
      Dear Nick, thank you for your advice, it worked fine! I already had the files installed, but maybe something got lost, because using
      Code:
      ssc install asdoc, replace
      did the job.

      Comment


      • #4
        After working perfectly fine the first time, it now is not working again, even though I have changed nothing in the code. I now also included
        Code:
        ssc install asdoc, replace
        as a permanent part of the code, so that it always replaces the already installed file, but I again got the error message <istmt>: 3499 set_column_formats() not found

        Comment


        • #5
          Now I think you do need the author's support.

          Comment

          Working...
          X