Announcement

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

  • Does "reverse" retain as official word?

    Dear Stata users,

    I installed a community contributed command -revrs- (SSC) written by Kyle Longest. I make a copy of this program (named reverse) and a copy of help file as well. However, when I type -help reverse-, Stata cannot find the right help file, and gives me error informations. The following is my copies of program and help file.

    Copy of -revrs- and saved as reverse.ado
    Code:
    *!revrs v1.0.1 12apr2007
    *Author: Kyle C Longest, [email protected]
    *Reorders categorical variables and maintains value labels
    
    program define reverse
    
    revrs `0'
    
    end
    Copy of its help file and saved as reverse.hlp (or reverse.sthlp)
    Code:
    .h revrs
    Here are results when I type -help reverse-
    Click image for larger version

Name:	_20211119115902.png
Views:	1
Size:	14.4 KB
ID:	1637174

    Last edited by Chen Samulsion; 18 Nov 2021, 20:59.

  • #2
    Reverse is not a reserved word. There is a list but it's relatively short. The general advice from StataCorp about making commands is to generally avoid English words (particularly verbs) as they reserve the right to use that name in future commands.

    I think the issue you are facing is that your ado and help file are either not in your current directory or along your ado path, and so Stata doesn't know that they exist.

    Comment


    • #3
      Thank you Leonardo Guizzetti, ado and help file I refered above are both stored in ado directory.

      Code:
      . which reverse
      c:\ado\plus\r\reverse.ado
      *!revrs v1.0.1 12apr2007
      
      . which reverse.hlp
      c:\ado\plus\r\reverse.hlp

      Comment


      • #4
        I will not comment further on the problems with revrs when not all values are observed in the data and how other community-contributed commands fix them.

        I will note that

        Code:
        .h revrs
        is most definitely not the contents of revrs.hlp from SSC. EDIT2: I think, Chen is aware of this and what wants the behavior I describe in the following sentence. I interpreted

        I make a copy of this program [...] and a copy of help file as well.
        verbatim to mean that Chen actually copied the contents of those two files; obviously, that is not the case. Anyway, the line

        Code:
        .h revrs
        (note the missing space after the period) redirects to revrs.hlp and/or rvers.sthlp. Having this one line in a help file is equivalent to typing

        Code:
        h revrs
        I have no idea why Stata points to f_reverse here. EDIT: Perhaps the alias file (sort of a dictionary for ado and help file abbreviations) for reverse, which is the old name for string function strreverse(), lists f_reverse but that help file is gone.


        Anyway, Leonardo pointed out that you should not use English words for your own command names. The major problem with using command names such as reverse is that your do-files might stop working in the future when StataCorp does implement their own reverse, because the ado-path is set up in a way that prioritizes command shipped with Stata. I would not spend too much time trying to figure out what exactly is going on; I would choose a different name.
        Last edited by daniel klein; 19 Nov 2021, 03:55.

        Comment


        • #5
          Thank you daniel, I have learn name regular of user-written command in Stata. I checked and the problem I report in #1 is not caused by illegal name. When I name it for example -rexyz- or anything else, Stata will pop up Viewer demonstrate me that
          help for revrs4 not found
          Screw it. We don't need to waste time on such problem.
          P.S. And thank you for your caution in first line that command -revrs- has bug in implementing data management tasks.
          Last edited by Chen Samulsion; 19 Nov 2021, 03:55. Reason: bugs of revrs

          Comment


          • #6
            Originally posted by Chen Samulsion View Post
            P.S. And thank you for your caution in first line that command -revrs- has bug in implementing data management tasks.
            I would not call it a bug; it is documented prominently in the help file. Having played around for quite a while with the underlying problem that revrs is trying to solve, I have noticed that it is pretty hard to look out for and catch all the possible problems, such as unobserved values in the dataset, unlabeled values in value labels, value labels being attached to multiple variables, variables having different value labels attached in multiple label languages, etc., in a fully automated fashion.

            Comment

            Working...
            X