Announcement

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

  • Two new programs, -rqrs- and -which_version-, available from SSC

    Thanks, as always to Kit Baum, two new programs, rqrs and which_version, are available for download from the SSC.

    rqrs is a simplistic program that basically acts as a wrapper around ssc install and net install. I use rqrs to document the community-contributed commands that I use in a do-file and to facilitate the installation of those community-contributed commands on other machines. An example looks like this

    Code:
    version 15
    
    rqrs findname
    
    
    When I do/run this do-file, rqrs checks whether findname (Cox, SSC; SJ) is found along the ado-path by calling Stata’s which command. If the command is not found, a window will pop up and ask whether I want to install findname now. If I confirm, findname will be installed from the SSC.

    If for no good reason, I wanted to download findname from SJ, if it was not found along the ado-path, I would set up my do-file as

    Code:
    version 15
    
    rqrs findname dm0048_3 , from(sj15-2)
    
    
    Here, I list the command that I want to use, findname, and the name of the respective package that contains the command, dm0048_3. I also indicate that the dm0048_3 package is to be downloaded from the Stata Journal 15, issue 2.

    Because my do-files would only work if rqrs was installed, I would add the core of rqrs.ado explicitly near the top of my do-file

    Code:
    version 15
    
    capture noisily which rqrs
    if ( _rc ) {
        capture window stopbox rusure "Do you want to install rqrs?"
        if ( _rc ) exit 111
        ssc install rqrs
    }
    
    rqrs ...
    For more sophisticated approaches to installing required community-contributed commands, see adolist (Jann and Wehrli, SSC), copycode (Schneider, SSC), and usepackage (Booth, SSC).


    which_version is an alternative to Stata’s which command that returns the location (full path and filename) of a command and, additionally, tries to extract the programmer’s version number. Here is an example

    Code:
    . which_version findname
    c:\ado\plus/f\findname.ado
    *! 1.0.4 NJC 24 March 2014 
    
    . sreturn list
    
    macros:
                     s(fn) : "c:\ado\plus/f\findname.ado"
                s(version) : "1.0.4"
    Perhaps some of you find these programs useful.

    Best
    Daniel
Working...
X