Announcement

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

  • Error using readreplace in Stata17 version

    Hi All,
    I'm now using the command: readreplace in Stata 17 version.
    I got the following error, please suggest to me how to fix it.
    Click image for larger version

Name:	error.png
Views:	2
Size:	10.9 KB
ID:	1611311


  • #2
    The end of help readreplace (a community contributed package available from SSC) tells us

    For questions or suggestions, submit a GitHub issue or e-mail [email protected].
    Following the link to Github shows that this issue has been raised there a few days ago. It also shows that the most recent update to the package was 7 years ago.
    Code:
    . which readreplace
    /Users/lisowskiw/Library/Application Support/Stata/ado/plus/r/readreplace.ado
    *! v1 by Ryan Knight 12jan2011
    *! version 2.0.0 Matthew White 26aug2014
    I will add that in a new session of Stata, running the readreplace command with no arguments seemed to succeed in loading the ado file.
    Code:
    . readreplace
    using required
    r(100);
    
    . program dir
      ado     2433  readreplace.import_replacements
      ado     3275  readreplace
     mata     4632  readreplace.readreplace()
     mata      608  readreplace.binary_search_last()
     mata      608  readreplace.binary_search_first()
     mata      512  readreplace.pcomp()
     mata      188  readreplace.st_sortlist()
     mata     1284  readreplace.st_promote_type()
     mata     1124  readreplace.numeric_promote_types()
     mata      300  readreplace.st_copy_view()
     mata      292  readreplace.st_sviewL()
     mata      336  readreplace.st_anystrL()
          --------
             15592

    Comment


    • #3
      The code in post #2 was run with Stata 16, and shows that loading readreplace.ado leads to the compilation of several Mata functions, including one named st_sortlist. The error message in post #1 seems to suggest that in Stata 17 there is now defined a built-in st_sortlist() function, although I can find no evidence of it in the Stata 17 documentation index.

      Let me suggest the following hack that may solve your problem. I cannot test this because I have yet to upgrade from Stata 16. Be sure your version of readreplace is the one I have, shown in post #2.
      Code:
      findfile readreplace.ado
      doedit "`r(fn)'"
      will open the installed copy of readreplace.ado in the Stata Do-file Editor.

      Find the two instances of st_sortlist in the file and add an x to the end of the name.

      From the File menu, save the edited do-file. Then
      Code:
      clear all
      program dir
      readreplace
      program dir
      might succeed and yield the following results.
      Code:
      . clear all
      
      . program dir
        ado      242  clear.clearreturn
        ado      603  clear._clear_9
        ado     1770  clear
            --------
                2615
      
      
      . readreplace
      using required
      r(100);
      
      . program dir
        ado     2433  readreplace.import_replacements
        ado     3275  readreplace
       mata     4632  readreplace.readreplace()
       mata      608  readreplace.binary_search_last()
       mata      608  readreplace.binary_search_first()
       mata      512  readreplace.pcomp()
       mata      188  readreplace.st_sortlistx()
       mata     1284  readreplace.st_promote_type()
       mata     1124  readreplace.numeric_promote_types()
       mata      300  readreplace.st_copy_view()
       mata      292  readreplace.st_sviewL()
       mata      336  readreplace.st_anystrL()
        ado      242  clear.clearreturn
        ado      603  clear._clear_9
        ado     1770  clear
            --------
               18207
      
      
      .
      And if so, perhaps the readreplace command will now run as you expect it to.


      Comment


      • #4
        William's advice is correct and he is also right that -st_sortlist()- is built-in with Stata 17 (though is undocumented). With some simple tests, Mata's -st_sortlist()- performs an analogous function as the custom function as part of the -readreplace- package: obtain r(sortlist) from -describe- and parse it into a string rowvector. The suggested modification will work across all supported versions, or if you only care about Stata 17, you can comment out the user-defined st_sortlist() and it will also work.

        Comment

        Working...
        X