Announcement

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

  • User-written command gsreg stopped working but only in my computer

    I have used gsreg many times. A few weeks ago, however, it stopped working. Specifically, no matter what I use it for, I get this message: "variable aux not found". I have tried in Stata 14, 16, and 17. The exact same code with the same data used to work. After a while, trying to figure out what was wrong, I noticed it works in any other computer I have tried. I have already tried uninstalling and installing gsreg again. I have also tried uninstalling and installing Stata again.

    I use the command often and it is much more convenient to be able to run it on my own computer. Does anyone have any idea of what might have happened so I can fix it?

    Thanks.

  • #2
    DISCLAIMER: I have never used -gsreg-. Have you tried using the replace option when re-installing it?

    Code:
    ssc install gsreg, replace
    I know this suggestion runs a bit counter to the following comments from -help ssc-, but I would give it a try anyway, I think! ;-)
    Code:
    replace specifies that any files being downloaded that already exist on your computer
    be replaced by the downloaded files. If replace is not specified and any files already
    exist, none of the files from the package is downloaded or installed.
    
    It is better not to specify the replace option and wait to see if there is a problem. 
    If there is a problem, it is usually better to uninstall the old package by using
    ssc uninstall or ado uninstall (which are, in fact, the same command).



    --
    Bruce Weaver
    Email: [email protected]
    Version: Stata/MP 19.5 (Windows)

    Comment


    • #3
      Here's my guess. In Stata on your computer you have

      Code:
      set varabbrev off
      gsreg (from SSC) is not going to work with that. The reason for my guess is that deep in the code a variable aux1 is generated, and then there is an instruction to rename aux to something else. I haven't checked anything above that point in the code, but why should that fail? Evidently the difficulty is that Stata cannot see a variable aux. The rename might work if variable name abbreviation is allowed but (it seems) not otherwise.

      This is not excellent coding style, if only for the extra reason that a user might already have an aux1.

      If you don't have that setting in your other copies of Stata then that would explain why it works in some places and not others.

      You could try fixing the code of gsreg, but that is dangerous too.

      You could have given more information by

      Code:
      set trace on 
      set tracedepth 1
      and showing us the code just before the command failed.


      Comment


      • #4
        Thanks to both of you for your answers.

        As usual, Nick as provided the key to solve the issue. As soon as I allowed name abbreviation, the code worked once again.

        PS. I was not aware of set trace on. Thanks for that too.
        Last edited by Tabare Capitan; 18 Jun 2023, 01:38.

        Comment

        Working...
        X