Announcement

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

  • Comprehensive up to date list of (built in) Stata commands and functions?

    I know I can find `ado` files corresponding to packaged commands in the Stata install folder. However, built in commands are not listed; furthermore, functions are not listed either.

    Old lists that exist online are, well, old and not up to date for Stata 15. Is there a comprehensive list?

  • #2
    I don't think there is any such list and StataCorp, I guess, have really good reasons for not providing it. There are numerous undocumented and non-documented commands and listing them would send the wrong signal. Whatever is not documented is considered subject to replacement by something quite different. There are also non-documented functions. (Conversely, StataCorp try really hard to ensure that old commands continue to work even if they go not documented or undocumented.)

    undocumented has a specific meaning in Stata as

    Code:
    help undocumented
    does list some commands, which is why I say "non-documented" to flag what is documented nowhere in documentation as distributed by StataCorp.

    Comment


    • #3
      Hi Mauricio,

      regarding Stata's built-in commands, the user written package getcmds by Jeff Pitblado (StataCorp) may help:
      Code:
      net describe getcmds , from(https://www.stata.com/users/jpitblado)
      This, however, does not help with functions.

      Kind regards
      Bela

      PS: Just in case you're up to create a definition for highlighting Stata syntax in external software, I would love to join.

      Comment


      • #4
        Nick Cox I'd be very happy to settle for a list of "official" commands and functions. Even commands listed in .ado don't always have their own help file, or are listed under various names, aliases are not listed, etc. I'm realizing that even to get a list of commands that are listed in "ado" would be a non-trivial amount of work.

        Daniel Bela If you are interested, I have created LaTeX and Pygments implementations. See github.com/mcaceresb/highlight-sas-stata. I also borrow from the highlighting.js and skylighting Stata implementations, but both have lists that are dated. Kyle Barron Created an implementation for Atom. See github.com/kylebarron/language-stata.

        He and I are trying to update our highlighting implementations in light of his new project, a Jupyter Stata kernel.

        Comment


        • #5
          I would also love such a list to update Vi/Vim syntax highlighting.

          Comment


          • #6
            Originally posted by Dimitriy V. Masterov View Post
            I would also love such a list to update Vi/Vim syntax highlighting.
            Jeff Pitblado (StataCorp) already took care of this for you: https://github.com/jpitblado/vim-stata

            This has the same issues as discussed here, namely the language definition is not up to date. Especially, it lacks current unicode-aware function names.


            Originally posted by Mauricio Caceres View Post

            Daniel Bela If you are interested, I have created LaTeX and Pygments implementations. See github.com/mcaceresb/highlight-sas-stata. I also borrow from the highlighting.js and skylighting Stata implementations, but both have lists that are dated.[...]
            Thanks for letting me know. I also have my own language definition file for LaTeX's listings package, which I will try to synchronize with your version. getcmds gives a great overview about commands (actually, it searches through the help file names to find the command names), and I think I can extend it to find all functions that are accessible via the help system. I'll head over to the corresponding GitHub issue for further discussion.

            Kind regards
            Bela

            Comment


            • #7
              Tastes differ, but I use Vim with Jeff's syntax highlighting just about every working day, have done so for many years, and the fact that it's not up-to-date on official command names -- or doesn't include any community-contributed command names so far as I know -- hasn't impeded me one bit. Syntax highlighting makes an ado file more colourful and that's pleasing. I don't think it often shows up a bug that wouldn't quickly be spotted otherwise.

              Comment


              • #8
                Based on some discussions at a few different Stata conferences, I think some of the challenges with functions is that they are built-in to the binary. The conversation came up when asking about providing a mechanism to allow for user-defined functions. That said, you could likely scrape function names out of the help files that correspond to the functions or from the functions manual in Stata 15.

                Comment


                • #9
                  I think Jeff's package is installed by default with vim? At least it's that I have installed and I never fiddled with Stata syntax on vim. I find it's good in most cases, and I suspect some of its limitations come from vimscript . As far as function names go, however, I would certainly prefer to have a more comprehensive list than is listed in his package (generally I think having a complete list is helpful, but at least unicode commands, functions, and mata functions ought to be there).


                  In any case, it sounds like there isn't a better route than to scrape the help files (perhaps in the style of `getcmds` or with a similar implementation).

                  Comment


                  • #10
                    The Stata syntax highlighting that comes with vim is from my first try. I have since made changes but did not want to bother Bram Moolenaar, so I held onto them until I got familiar with git and GitHub and felt like sharing them again. I intentionally kept short the list of Stata commands recognized in syntax/stata.vim, because the way vim matches keywords does not account for their placement within a given line of text.

                    I just pushed an update to my GitHub repo that includes the full list of documented functions in Stata 15. Here is the link

                    https://github.com/jpitblado/vim-stata

                    I added a brief note in the README describing how to get syntax highlighting for the complete list of documented and 'undocumented' commands in Stata 15.

                    Comment


                    • #11
                      Jeff Pitblado (StataCorp) Thank you for your public goods provision.

                      I am getting am error when I try to execute that last step:

                      Code:
                      $ ln -s stata_commands.vim  $HOME/.vim/after/syntax/stata.vim
                      ln: /Users/dimitriy/.vim/after/syntax/stata.vim: No such file or directory
                      I believe I installed pathogen correctly. Any suggestions?

                      Comment


                      • #12
                        I updated the README instructions for stata_commands.vim to be a little more explicit. Basically you will probably need to create the folder $HOME/.vim/after/syntax/ before copying or linking stata_commands.vim.

                        Code:
                        mkdir -p $HOME/.vim/after/syntax
                        ln -s $PWD/stata_commands.vim $HOME/.vim/after/syntax/stata.vim

                        Comment


                        • #13
                          I am also trying to find all built-in commands in Stata, and as far as I see both user contributed programs -getcmds- by Jeff Pitblado (StataCorp) and -statacmds- by Daniel Bela are not finding all built-in commands:

                          For example the lists produced by both -getcmds- and -statacmds- do not include the built-in command - _regress - and this command exists:

                          Code:
                          . which _regress
                          built-in command:  _regress

                          So my questions is, are these two user contributed commands -getcmds- and -statacmds- the only known way to obtain list of built-in commands in Stata?

                          Comment


                          • #14
                            Originally posted by Joro Kolev View Post
                            I am also trying to find all built-in commands in Stata, and as far as I see both user contributed programs -getcmds- by Jeff Pitblado (StataCorp) and -statacmds- by Daniel Bela are not finding all built-in commands:

                            For example the lists produced by both -getcmds- and -statacmds- do not include the built-in command - _regress - and this command exists:

                            Code:
                            . which _regress
                            built-in command: _regress

                            So my questions is, are these two user contributed commands -getcmds- and -statacmds- the only known way to obtain list of built-in commands in Stata?
                            My program -statacmds- just mimics the behavior of -getcmds-, and adds some functionality; the core mechanism of both programs is to parse the names of help files to identify commands. Built-in programs or functions that are not accompanied by a help file, like _regress, can,of course, no be detected by this mechanism.

                            Regards
                            Bela

                            Comment

                            Working...
                            X